');
// append stage
this.$element.append(this.$stage.parent());
// append content
this.replace(this.$element.children().not(this.$stage.parent()));
// set view width
this._width = this.$element.width();
// update view
this.refresh();
this.$element.removeClass('owl-loading').addClass('owl-loaded');
// attach generic events
this.eventsCall();
// attach generic events
this.internalEvents();
// attach custom control events
this.addTriggerableEvents();
this.trigger('initialized');
};
/**
* Setups the current settings.
* @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
* @todo Support for media queries by using `matchMedia` would be nice.
* @public
*/
Owl.prototype.setup = function() {
var viewport = this.viewport(),
overwrites = this.options.responsive,
match = -1,
settings = null;
if (!overwrites) {
settings = $.extend({}, this.options);
} else {
$.each(overwrites, function(breakpoint) {
if (breakpoint <= viewport && breakpoint > match) {
match = Number(breakpoint);
}
});
settings = $.extend({}, this.options, overwrites[match]);
delete settings.responsive;
// responsive class
if (settings.responsiveClass) {
this.$element.attr('class', function(i, c) {
return c.replace(/\b owl-responsive-\S+/g, '');
}).addClass('owl-responsive-' + match);
}
}
if (this.settings === null || this._breakpoint !== match) {
this.trigger('change', { property: { name: 'settings', value: settings } });
this._breakpoint = match;
this.settings = settings;
this.invalidate('settings');
this.trigger('changed', { property: { name: 'settings', value: this.settings } });
}
};
/**
* Updates option logic if necessery.
* @protected
*/
Owl.prototype.optionsLogic = function() {
// Toggle Center class
this.$element.toggleClass('owl-center', this.settings.center);
// if items number is less than in body
if (this.settings.loop && this._items.length < this.settings.items) {
this.settings.loop = false;
}
if (this.settings.autoWidth) {
this.settings.stagePadding = false;
this.settings.merge = false;
}
};
/**
* Prepares an item before add.
* @todo Rename event parameter `content` to `item`.
* @protected
* @returns {jQuery|HTMLElement} - The item container.
*/
Owl.prototype.prepare = function(item) {
var event = this.trigger('prepare', { content: item });
if (!event.data) {
event.data = $('<' + this.settings.itemElement + '/>')
.addClass(this.settings.itemClass).append(item)
}
this.trigger('prepared', { content: event.data });
return event.data;
};
/**
* Updates the view.
* @public
*/
Owl.prototype.update = function() {
var i = 0,
n = this._pipe.length,
filter = $.proxy(function(p) { return this[p] }, this._invalidated),
cache = {};
while (i < n) {
if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
this._pipe[i].run(cache);
}
i++;
}
this._invalidated = {};
};
/**
* Gets the width of the view.
* @public
* @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
* @returns {Number} - The width of the view in pixel.
*/
Owl.prototype.width = function(dimension) {
dimension = dimension || Owl.Width.Default;
switch (dimension) {
case Owl.Width.Inner:
case Owl.Width.Outer:
return this._width;
default:
return this._width - this.settings.stagePadding * 2 + this.settings.margin;
}
};
/**
* Refreshes the carousel primarily for adaptive purposes.
* @public
*/
Owl.prototype.refresh = function() {
if (this._items.length === 0) {
return false;
}
var start = new Date().getTime();
this.trigger('refresh');
this.setup();
this.optionsLogic();
// hide and show methods helps here to set a proper widths,
// this prevents scrollbar to be calculated in stage width
this.$stage.addClass('owl-refresh');
this.update();
this.$stage.removeClass('owl-refresh');
this.state.orientation = window.orientation;
this.watchVisibility();
this.trigger('refreshed');
};
/**
* Save internal event references and add event based functions.
* @protected
*/
Owl.prototype.eventsCall = function() {
// Save events references
this.e._onDragStart = $.proxy(function(e) {
this.onDragStart(e);
}, this);
this.e._onDragMove = $.proxy(function(e) {
this.onDragMove(e);
}, this);
this.e._onDragEnd = $.proxy(function(e) {
this.onDragEnd(e);
}, this);
this.e._onResize = $.proxy(function(e) {
this.onResize(e);
}, this);
this.e._transitionEnd = $.proxy(function(e) {
this.transitionEnd(e);
}, this);
this.e._preventClick = $.proxy(function(e) {
this.preventClick(e);
}, this);
};
/**
* Checks window `resize` event.
* @protected
*/
Owl.prototype.onThrottledResize = function() {
window.clearTimeout(this.resizeTimer);
this.resizeTimer = window.setTimeout(this.e._onResize, this.settings.responsiveRefreshRate);
};
/**
* Checks window `resize` event.
* @protected
*/
Owl.prototype.onResize = function() {
if (!this._items.length) {
return false;
}
if (this._width === this.$element.width()) {
return false;
}
if (this.trigger('resize').isDefaultPrevented()) {
return false;
}
this._width = this.$element.width();
this.invalidate('width');
this.refresh();
this.trigger('resized');
};
/**
* Checks for touch/mouse drag event type and add run event handlers.
* @protected
*/
Owl.prototype.eventsRouter = function(event) {
var type = event.type;
if (type === "mousedown" || type === "touchstart") {
this.onDragStart(event);
} else if (type === "mousemove" || type === "touchmove") {
this.onDragMove(event);
} else if (type === "mouseup" || type === "touchend") {
this.onDragEnd(event);
} else if (type === "touchcancel") {
this.onDragEnd(event);
}
};
/**
* Checks for touch/mouse drag options and add necessery event handlers.
* @protected
*/
Owl.prototype.internalEvents = function() {
var isTouch = isTouchSupport(),
isTouchIE = isTouchSupportIE();
if (this.settings.mouseDrag){
this.$stage.on('mousedown', $.proxy(function(event) { this.eventsRouter(event) }, this));
this.$stage.on('dragstart', function() { return false });
this.$stage.get(0).onselectstart = function() { return false };
} else {
this.$element.addClass('owl-text-select-on');
}
if (this.settings.touchDrag && !isTouchIE){
this.$stage.on('touchstart touchcancel', $.proxy(function(event) { this.eventsRouter(event) }, this));
}
// catch transitionEnd event
if (this.transitionEndVendor) {
this.on(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd, false);
}
// responsive
if (this.settings.responsive !== false) {
this.on(window, 'resize', $.proxy(this.onThrottledResize, this));
}
};
/**
* Handles touchstart/mousedown event.
* @protected
* @param {Event} event - The event arguments.
*/
Owl.prototype.onDragStart = function(event) {
var ev, isTouchEvent, pageX, pageY, animatedPos;
ev = event.originalEvent || event || window.event;
// prevent right click
if (ev.which === 3 || this.state.isTouch) {
return false;
}
if (ev.type === 'mousedown') {
this.$stage.addClass('owl-grab');
}
this.trigger('drag');
this.drag.startTime = new Date().getTime();
this.speed(0);
this.state.isTouch = true;
this.state.isScrolling = false;
this.state.isSwiping = false;
this.drag.distance = 0;
pageX = getTouches(ev).x;
pageY = getTouches(ev).y;
// get stage position left
this.drag.offsetX = this.$stage.position().left;
this.drag.offsetY = this.$stage.position().top;
if (this.settings.rtl) {
this.drag.offsetX = this.$stage.position().left + this.$stage.width() - this.width()
+ this.settings.margin;
}
// catch position // ie to fix
if (this.state.inMotion && this.support3d) {
animatedPos = this.getTransformProperty();
this.drag.offsetX = animatedPos;
this.animate(animatedPos);
this.state.inMotion = true;
} else if (this.state.inMotion && !this.support3d) {
this.state.inMotion = false;
return false;
}
this.drag.startX = pageX - this.drag.offsetX;
this.drag.startY = pageY - this.drag.offsetY;
this.drag.start = pageX - this.drag.startX;
this.drag.targetEl = ev.target || ev.srcElement;
this.drag.updatedX = this.drag.start;
// to do/check
// prevent links and images dragging;
if (this.drag.targetEl.tagName === "IMG" || this.drag.targetEl.tagName === "A") {
this.drag.targetEl.draggable = false;
}
$(document).on('mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents', $.proxy(function(event) {this.eventsRouter(event)},this));
};
/**
* Handles the touchmove/mousemove events.
* @todo Simplify
* @protected
* @param {Event} event - The event arguments.
*/
Owl.prototype.onDragMove = function(event) {
var ev, isTouchEvent, pageX, pageY, minValue, maxValue, pull;
if (!this.state.isTouch) {
return;
}
if (this.state.isScrolling) {
return;
}
ev = event.originalEvent || event || window.event;
pageX = getTouches(ev).x;
pageY = getTouches(ev).y;
// Drag Direction
this.drag.currentX = pageX - this.drag.startX;
this.drag.currentY = pageY - this.drag.startY;
this.drag.distance = this.drag.currentX - this.drag.offsetX;
// Check move direction
if (this.drag.distance < 0) {
this.state.direction = this.settings.rtl ? 'right' : 'left';
} else if (this.drag.distance > 0) {
this.state.direction = this.settings.rtl ? 'left' : 'right';
}
// Loop
if (this.settings.loop) {
if (this.op(this.drag.currentX, '>', this.coordinates(this.minimum())) && this.state.direction === 'right') {
this.drag.currentX -= (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
} else if (this.op(this.drag.currentX, '<', this.coordinates(this.maximum())) && this.state.direction === 'left') {
this.drag.currentX += (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
}
} else {
// pull
minValue = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
maxValue = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
pull = this.settings.pullDrag ? this.drag.distance / 5 : 0;
this.drag.currentX = Math.max(Math.min(this.drag.currentX, minValue + pull), maxValue + pull);
}
// Lock browser if swiping horizontal
if ((this.drag.distance > 8 || this.drag.distance < -8)) {
if (ev.preventDefault !== undefined) {
ev.preventDefault();
} else {
ev.returnValue = false;
}
this.state.isSwiping = true;
}
this.drag.updatedX = this.drag.currentX;
// Lock Owl if scrolling
if ((this.drag.currentY > 16 || this.drag.currentY < -16) && this.state.isSwiping === false) {
this.state.isScrolling = true;
this.drag.updatedX = this.drag.start;
}
this.animate(this.drag.updatedX);
};
/**
* Handles the touchend/mouseup events.
* @protected
*/
Owl.prototype.onDragEnd = function(event) {
var compareTimes, distanceAbs, closest;
if (!this.state.isTouch) {
return;
}
if (event.type === 'mouseup') {
this.$stage.removeClass('owl-grab');
}
this.trigger('dragged');
// prevent links and images dragging;
this.drag.targetEl.removeAttribute("draggable");
// remove drag event listeners
this.state.isTouch = false;
this.state.isScrolling = false;
this.state.isSwiping = false;
// to check
if (this.drag.distance === 0 && this.state.inMotion !== true) {
this.state.inMotion = false;
return false;
}
// prevent clicks while scrolling
this.drag.endTime = new Date().getTime();
compareTimes = this.drag.endTime - this.drag.startTime;
distanceAbs = Math.abs(this.drag.distance);
// to test
if (distanceAbs > 3 || compareTimes > 300) {
this.removeClick(this.drag.targetEl);
}
closest = this.closest(this.drag.updatedX);
this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
this.current(closest);
this.invalidate('position');
this.update();
// if pullDrag is off then fire transitionEnd event manually when stick
// to border
if (!this.settings.pullDrag && this.drag.updatedX === this.coordinates(closest)) {
this.transitionEnd();
}
this.drag.distance = 0;
$(document).off('.owl.dragEvents');
};
/**
* Attaches `preventClick` to disable link while swipping.
* @protected
* @param {HTMLElement} [target] - The target of the `click` event.
*/
Owl.prototype.removeClick = function(target) {
this.drag.targetEl = target;
$(target).on('click.preventClick', this.e._preventClick);
// to make sure click is removed:
window.setTimeout(function() {
$(target).off('click.preventClick');
}, 300);
};
/**
* Suppresses click event.
* @protected
* @param {Event} ev - The event arguments.
*/
Owl.prototype.preventClick = function(ev) {
if (ev.preventDefault) {
ev.preventDefault();
} else {
ev.returnValue = false;
}
if (ev.stopPropagation) {
ev.stopPropagation();
}
$(ev.target).off('click.preventClick');
};
/**
* Catches stage position while animate (only CSS3).
* @protected
* @returns
*/
Owl.prototype.getTransformProperty = function() {
var transform, matrix3d;
transform = window.getComputedStyle(this.$stage.get(0), null).getPropertyValue(this.vendorName + 'transform');
// var transform = this.$stage.css(this.vendorName + 'transform')
transform = transform.replace(/matrix(3d)?\(|\)/g, '').split(',');
matrix3d = transform.length === 16;
return matrix3d !== true ? transform[4] : transform[12];
};
/**
* Gets absolute position of the closest item for a coordinate.
* @todo Setting `freeDrag` makes `closest` not reusable. See #165.
* @protected
* @param {Number} coordinate - The coordinate in pixel.
* @return {Number} - The absolute position of the closest item.
*/
Owl.prototype.closest = function(coordinate) {
var position = -1, pull = 30, width = this.width(), coordinates = this.coordinates();
if (!this.settings.freeDrag) {
// check closest item
$.each(coordinates, $.proxy(function(index, value) {
if (coordinate > value - pull && coordinate < value + pull) {
position = index;
} else if (this.op(coordinate, '<', value)
&& this.op(coordinate, '>', coordinates[index + 1] || value - width)) {
position = this.state.direction === 'left' ? index + 1 : index;
}
return position === -1;
}, this));
}
if (!this.settings.loop) {
// non loop boundries
if (this.op(coordinate, '>', coordinates[this.minimum()])) {
position = coordinate = this.minimum();
} else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
position = coordinate = this.maximum();
}
}
return position;
};
/**
* Animates the stage.
* @public
* @param {Number} coordinate - The coordinate in pixels.
*/
Owl.prototype.animate = function(coordinate) {
this.trigger('translate');
this.state.inMotion = this.speed() > 0;
if (this.support3d) {
this.$stage.css({
transform: 'translate3d(' + coordinate + 'px' + ',0px, 0px)',
transition: (this.speed() / 1000) + 's'
});
} else if (this.state.isTouch) {
this.$stage.css({
left: coordinate + 'px'
});
} else {
this.$stage.animate({
left: coordinate
}, this.speed() / 1000, this.settings.fallbackEasing, $.proxy(function() {
if (this.state.inMotion) {
this.transitionEnd();
}
}, this));
}
};
/**
* Sets the absolute position of the current item.
* @public
* @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
* @returns {Number} - The absolute position of the current item.
*/
Owl.prototype.current = function(position) {
if (position === undefined) {
return this._current;
}
if (this._items.length === 0) {
return undefined;
}
position = this.normalize(position);
if (this._current !== position) {
var event = this.trigger('change', { property: { name: 'position', value: position } });
if (event.data !== undefined) {
position = this.normalize(event.data);
}
this._current = position;
this.invalidate('position');
this.trigger('changed', { property: { name: 'position', value: this._current } });
}
return this._current;
};
/**
* Invalidates the given part of the update routine.
* @param {String} part - The part to invalidate.
*/
Owl.prototype.invalidate = function(part) {
this._invalidated[part] = true;
}
/**
* Resets the absolute position of the current item.
* @public
* @param {Number} position - The absolute position of the new item.
*/
Owl.prototype.reset = function(position) {
position = this.normalize(position);
if (position === undefined) {
return;
}
this._speed = 0;
this._current = position;
this.suppress([ 'translate', 'translated' ]);
this.animate(this.coordinates(position));
this.release([ 'translate', 'translated' ]);
};
/**
* Normalizes an absolute or a relative position for an item.
* @public
* @param {Number} position - The absolute or relative position to normalize.
* @param {Boolean} [relative=false] - Whether the given position is relative or not.
* @returns {Number} - The normalized position.
*/
Owl.prototype.normalize = function(position, relative) {
var n = (relative ? this._items.length : this._items.length + this._clones.length);
if (!$.isNumeric(position) || n < 1) {
return undefined;
}
if (this._clones.length) {
position = ((position % n) + n) % n;
} else {
position = Math.max(this.minimum(relative), Math.min(this.maximum(relative), position));
}
return position;
};
/**
* Converts an absolute position for an item into a relative position.
* @public
* @param {Number} position - The absolute position to convert.
* @returns {Number} - The converted position.
*/
Owl.prototype.relative = function(position) {
position = this.normalize(position);
position = position - this._clones.length / 2;
return this.normalize(position, true);
};
/**
* Gets the maximum position for an item.
* @public
* @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
* @returns {Number}
*/
Owl.prototype.maximum = function(relative) {
var maximum, width, i = 0, coordinate,
settings = this.settings;
if (relative) {
return this._items.length - 1;
}
if (!settings.loop && settings.center) {
maximum = this._items.length - 1;
} else if (!settings.loop && !settings.center) {
maximum = this._items.length - settings.items;
} else if (settings.loop || settings.center) {
maximum = this._items.length + settings.items;
} else if (settings.autoWidth || settings.merge) {
revert = settings.rtl ? 1 : -1;
width = this.$stage.width() - this.$element.width();
while (coordinate = this.coordinates(i)) {
if (coordinate * revert >= width) {
break;
}
maximum = ++i;
}
} else {
throw 'Can not detect maximum absolute position.'
}
return maximum;
};
/**
* Gets the minimum position for an item.
* @public
* @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
* @returns {Number}
*/
Owl.prototype.minimum = function(relative) {
if (relative) {
return 0;
}
return this._clones.length / 2;
};
/**
* Gets an item at the specified relative position.
* @public
* @param {Number} [position] - The relative position of the item.
* @return {jQuery|Array.
} - The item at the given position or all items if no position was given.
*/
Owl.prototype.items = function(position) {
if (position === undefined) {
return this._items.slice();
}
position = this.normalize(position, true);
return this._items[position];
};
/**
* Gets an item at the specified relative position.
* @public
* @param {Number} [position] - The relative position of the item.
* @return {jQuery|Array.} - The item at the given position or all items if no position was given.
*/
Owl.prototype.mergers = function(position) {
if (position === undefined) {
return this._mergers.slice();
}
position = this.normalize(position, true);
return this._mergers[position];
};
/**
* Gets the absolute positions of clones for an item.
* @public
* @param {Number} [position] - The relative position of the item.
* @returns {Array.} - The absolute positions of clones for the item or all if no position was given.
*/
Owl.prototype.clones = function(position) {
var odd = this._clones.length / 2,
even = odd + this._items.length,
map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
if (position === undefined) {
return $.map(this._clones, function(v, i) { return map(i) });
}
return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
};
/**
* Sets the current animation speed.
* @public
* @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
* @returns {Number} - The current animation speed in milliseconds.
*/
Owl.prototype.speed = function(speed) {
if (speed !== undefined) {
this._speed = speed;
}
return this._speed;
};
/**
* Gets the coordinate of an item.
* @todo The name of this method is missleanding.
* @public
* @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
* @returns {Number|Array.} - The coordinate of the item in pixel or all coordinates.
*/
Owl.prototype.coordinates = function(position) {
var coordinate = null;
if (position === undefined) {
return $.map(this._coordinates, $.proxy(function(coordinate, index) {
return this.coordinates(index);
}, this));
}
if (this.settings.center) {
coordinate = this._coordinates[position];
coordinate += (this.width() - coordinate + (this._coordinates[position - 1] || 0)) / 2 * (this.settings.rtl ? -1 : 1);
} else {
coordinate = this._coordinates[position - 1] || 0;
}
return coordinate;
};
/**
* Calculates the speed for a translation.
* @protected
* @param {Number} from - The absolute position of the start item.
* @param {Number} to - The absolute position of the target item.
* @param {Number} [factor=undefined] - The time factor in milliseconds.
* @returns {Number} - The time in milliseconds for the translation.
*/
Owl.prototype.duration = function(from, to, factor) {
return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
};
/**
* Slides to the specified item.
* @public
* @param {Number} position - The position of the item.
* @param {Number} [speed] - The time in milliseconds for the transition.
*/
Owl.prototype.to = function(position, speed) {
if (this.settings.loop) {
var distance = position - this.relative(this.current()),
revert = this.current(),
before = this.current(),
after = this.current() + distance,
direction = before - after < 0 ? true : false,
items = this._clones.length + this._items.length;
if (after < this.settings.items && direction === false) {
revert = before + this._items.length;
this.reset(revert);
} else if (after >= items - this.settings.items && direction === true) {
revert = before - this._items.length;
this.reset(revert);
}
window.clearTimeout(this.e._goToLoop);
this.e._goToLoop = window.setTimeout($.proxy(function() {
this.speed(this.duration(this.current(), revert + distance, speed));
this.current(revert + distance);
this.update();
}, this), 30);
} else {
this.speed(this.duration(this.current(), position, speed));
this.current(position);
this.update();
}
};
/**
* Slides to the next item.
* @public
* @param {Number} [speed] - The time in milliseconds for the transition.
*/
Owl.prototype.next = function(speed) {
speed = speed || false;
this.to(this.relative(this.current()) + 1, speed);
};
/**
* Slides to the previous item.
* @public
* @param {Number} [speed] - The time in milliseconds for the transition.
*/
Owl.prototype.prev = function(speed) {
speed = speed || false;
this.to(this.relative(this.current()) - 1, speed);
};
/**
* Handles the end of an animation.
* @protected
* @param {Event} event - The event arguments.
*/
Owl.prototype.transitionEnd = function(event) {
// if css2 animation then event object is undefined
if (event !== undefined) {
event.stopPropagation();
// Catch only owl-stage transitionEnd event
if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
return false;
}
}
this.state.inMotion = false;
this.trigger('translated');
};
/**
* Gets viewport width.
* @protected
* @return {Number} - The width in pixel.
*/
Owl.prototype.viewport = function() {
var width;
if (this.options.responsiveBaseElement !== window) {
width = $(this.options.responsiveBaseElement).width();
} else if (window.innerWidth) {
width = window.innerWidth;
} else if (document.documentElement && document.documentElement.clientWidth) {
width = document.documentElement.clientWidth;
} else {
throw 'Can not detect viewport width.';
}
return width;
};
/**
* Replaces the current content.
* @public
* @param {HTMLElement|jQuery|String} content - The new content.
*/
Owl.prototype.replace = function(content) {
this.$stage.empty();
this._items = [];
if (content) {
content = (content instanceof jQuery) ? content : $(content);
}
if (this.settings.nestedItemSelector) {
content = content.find('.' + this.settings.nestedItemSelector);
}
content.filter(function() {
return this.nodeType === 1;
}).each($.proxy(function(index, item) {
item = this.prepare(item);
this.$stage.append(item);
this._items.push(item);
this._mergers.push(item.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
}, this));
this.reset($.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
this.invalidate('items');
};
/**
* Adds an item.
* @todo Use `item` instead of `content` for the event arguments.
* @public
* @param {HTMLElement|jQuery|String} content - The item content to add.
* @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
*/
Owl.prototype.add = function(content, position) {
position = position === undefined ? this._items.length : this.normalize(position, true);
this.trigger('add', { content: content, position: position });
if (this._items.length === 0 || position === this._items.length) {
this.$stage.append(content);
this._items.push(content);
this._mergers.push(content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
} else {
this._items[position].before(content);
this._items.splice(position, 0, content);
this._mergers.splice(position, 0, content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
}
this.invalidate('items');
this.trigger('added', { content: content, position: position });
};
/**
* Removes an item by its position.
* @todo Use `item` instead of `content` for the event arguments.
* @public
* @param {Number} position - The relative position of the item to remove.
*/
Owl.prototype.remove = function(position) {
position = this.normalize(position, true);
if (position === undefined) {
return;
}
this.trigger('remove', { content: this._items[position], position: position });
this._items[position].remove();
this._items.splice(position, 1);
this._mergers.splice(position, 1);
this.invalidate('items');
this.trigger('removed', { content: null, position: position });
};
/**
* Adds triggerable events.
* @protected
*/
Owl.prototype.addTriggerableEvents = function() {
var handler = $.proxy(function(callback, event) {
return $.proxy(function(e) {
if (e.relatedTarget !== this) {
this.suppress([ event ]);
callback.apply(this, [].slice.call(arguments, 1));
this.release([ event ]);
}
}, this);
}, this);
$.each({
'next': this.next,
'prev': this.prev,
'to': this.to,
'destroy': this.destroy,
'refresh': this.refresh,
'replace': this.replace,
'add': this.add,
'remove': this.remove
}, $.proxy(function(event, callback) {
this.$element.on(event + '.owl.carousel', handler(callback, event + '.owl.carousel'));
}, this));
};
/**
* Watches the visibility of the carousel element.
* @protected
*/
Owl.prototype.watchVisibility = function() {
// test on zepto
if (!isElVisible(this.$element.get(0))) {
this.$element.addClass('owl-hidden');
window.clearInterval(this.e._checkVisibile);
this.e._checkVisibile = window.setInterval($.proxy(checkVisible, this), 500);
}
function isElVisible(el) {
return el.offsetWidth > 0 && el.offsetHeight > 0;
}
function checkVisible() {
if (isElVisible(this.$element.get(0))) {
this.$element.removeClass('owl-hidden');
this.refresh();
window.clearInterval(this.e._checkVisibile);
}
}
};
/**
* Preloads images with auto width.
* @protected
* @todo Still to test
*/
Owl.prototype.preloadAutoWidthImages = function(imgs) {
var loaded, that, $el, img;
loaded = 0;
that = this;
imgs.each(function(i, el) {
$el = $(el);
img = new Image();
img.onload = function() {
loaded++;
$el.attr('src', img.src);
$el.css('opacity', 1);
if (loaded >= imgs.length) {
that.state.imagesLoaded = true;
that.initialize();
}
};
img.src = $el.attr('src') || $el.attr('data-src') || $el.attr('data-src-retina');
});
};
/**
* Destroys the carousel.
* @public
*/
Owl.prototype.destroy = function() {
if (this.$element.hasClass(this.settings.themeClass)) {
this.$element.removeClass(this.settings.themeClass);
}
if (this.settings.responsive !== false) {
$(window).off('resize.owl.carousel');
}
if (this.transitionEndVendor) {
this.off(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd);
}
for ( var i in this._plugins) {
this._plugins[i].destroy();
}
if (this.settings.mouseDrag || this.settings.touchDrag) {
this.$stage.off('mousedown touchstart touchcancel');
$(document).off('.owl.dragEvents');
this.$stage.get(0).onselectstart = function() {};
this.$stage.off('dragstart', function() { return false });
}
// remove event handlers in the ".owl.carousel" namespace
this.$element.off('.owl');
this.$stage.children('.cloned').remove();
this.e = null;
this.$element.removeData('owlCarousel');
this.$stage.children().contents().unwrap();
this.$stage.children().unwrap();
this.$stage.unwrap();
};
/**
* Operators to calculate right-to-left and left-to-right.
* @protected
* @param {Number} [a] - The left side operand.
* @param {String} [o] - The operator.
* @param {Number} [b] - The right side operand.
*/
Owl.prototype.op = function(a, o, b) {
var rtl = this.settings.rtl;
switch (o) {
case '<':
return rtl ? a > b : a < b;
case '>':
return rtl ? a < b : a > b;
case '>=':
return rtl ? a <= b : a >= b;
case '<=':
return rtl ? a >= b : a <= b;
default:
break;
}
};
/**
* Attaches to an internal event.
* @protected
* @param {HTMLElement} element - The event source.
* @param {String} event - The event name.
* @param {Function} listener - The event handler to attach.
* @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
*/
Owl.prototype.on = function(element, event, listener, capture) {
if (element.addEventListener) {
element.addEventListener(event, listener, capture);
} else if (element.attachEvent) {
element.attachEvent('on' + event, listener);
}
};
/**
* Detaches from an internal event.
* @protected
* @param {HTMLElement} element - The event source.
* @param {String} event - The event name.
* @param {Function} listener - The attached event handler to detach.
* @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
*/
Owl.prototype.off = function(element, event, listener, capture) {
if (element.removeEventListener) {
element.removeEventListener(event, listener, capture);
} else if (element.detachEvent) {
element.detachEvent('on' + event, listener);
}
};
/**
* Triggers an public event.
* @protected
* @param {String} name - The event name.
* @param {*} [data=null] - The event data.
* @param {String} [namespace=.owl.carousel] - The event namespace.
* @returns {Event} - The event arguments.
*/
Owl.prototype.trigger = function(name, data, namespace) {
var status = {
item: { count: this._items.length, index: this.current() }
}, handler = $.camelCase(
$.grep([ 'on', name, namespace ], function(v) { return v })
.join('-').toLowerCase()
), event = $.Event(
[ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
$.extend({ relatedTarget: this }, status, data)
);
if (!this._supress[name]) {
$.each(this._plugins, function(name, plugin) {
if (plugin.onTrigger) {
plugin.onTrigger(event);
}
});
this.$element.trigger(event);
if (this.settings && typeof this.settings[handler] === 'function') {
this.settings[handler].apply(this, event);
}
}
return event;
};
/**
* Suppresses events.
* @protected
* @param {Array.} events - The events to suppress.
*/
Owl.prototype.suppress = function(events) {
$.each(events, $.proxy(function(index, event) {
this._supress[event] = true;
}, this));
}
/**
* Releases suppressed events.
* @protected
* @param {Array.} events - The events to release.
*/
Owl.prototype.release = function(events) {
$.each(events, $.proxy(function(index, event) {
delete this._supress[event];
}, this));
}
/**
* Checks the availability of some browser features.
* @protected
*/
Owl.prototype.browserSupport = function() {
this.support3d = isPerspective();
if (this.support3d) {
this.transformVendor = isTransform();
// take transitionend event name by detecting transition
var endVendors = [ 'transitionend', 'webkitTransitionEnd', 'transitionend', 'oTransitionEnd' ];
this.transitionEndVendor = endVendors[isTransition()];
// take vendor name from transform name
this.vendorName = this.transformVendor.replace(/Transform/i, '');
this.vendorName = this.vendorName !== '' ? '-' + this.vendorName.toLowerCase() + '-' : '';
}
this.state.orientation = window.orientation;
};
/**
* Get touch/drag coordinats.
* @private
* @param {event} - mousedown/touchstart event
* @returns {object} - Contains X and Y of current mouse/touch position
*/
function getTouches(event) {
if (event.touches !== undefined) {
return {
x: event.touches[0].pageX,
y: event.touches[0].pageY
};
}
if (event.touches === undefined) {
if (event.pageX !== undefined) {
return {
x: event.pageX,
y: event.pageY
};
}
if (event.pageX === undefined) {
return {
x: event.clientX,
y: event.clientY
};
}
}
}
/**
* Checks for CSS support.
* @private
* @param {Array} array - The CSS properties to check for.
* @returns {Array} - Contains the supported CSS property name and its index or `false`.
*/
function isStyleSupported(array) {
var p, s, fake = document.createElement('div'), list = array;
for (p in list) {
s = list[p];
if (typeof fake.style[s] !== 'undefined') {
fake = null;
return [ s, p ];
}
}
return [ false ];
}
/**
* Checks for CSS transition support.
* @private
* @todo Realy bad design
* @returns {Number}
*/
function isTransition() {
return isStyleSupported([ 'transition', 'WebkitTransition', 'MozTransition', 'OTransition' ])[1];
}
/**
* Checks for CSS transform support.
* @private
* @returns {String} The supported property name or false.
*/
function isTransform() {
return isStyleSupported([ 'transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ])[0];
}
/**
* Checks for CSS perspective support.
* @private
* @returns {String} The supported property name or false.
*/
function isPerspective() {
return isStyleSupported([ 'perspective', 'webkitPerspective', 'MozPerspective', 'OPerspective', 'MsPerspective' ])[0];
}
/**
* Checks wether touch is supported or not.
* @private
* @returns {Boolean}
*/
function isTouchSupport() {
return 'ontouchstart' in window || !!(navigator.msMaxTouchPoints);
}
/**
* Checks wether touch is supported or not for IE.
* @private
* @returns {Boolean}
*/
function isTouchSupportIE() {
return window.navigator.msPointerEnabled;
}
/**
* The jQuery Plugin for the Owl Carousel
* @public
*/
$.fn.owlCarousel = function(options) {
return this.each(function() {
if (!$(this).data('owlCarousel')) {
$(this).data('owlCarousel', new Owl(this, options));
}
});
};
/**
* The constructor for the jQuery Plugin
* @public
*/
$.fn.owlCarousel.Constructor = Owl;
})(window.Zepto || window.jQuery, window, document);
/**
* Lazy Plugin
* @version 2.0.0
* @author Bartosz Wojciechowski
* @license The MIT License (MIT)
*/
;(function($, window, document, undefined) {
/**
* Creates the lazy plugin.
* @class The Lazy Plugin
* @param {Owl} carousel - The Owl Carousel
*/
var Lazy = function(carousel) {
/**
* Reference to the core.
* @protected
* @type {Owl}
*/
this._core = carousel;
/**
* Already loaded items.
* @protected
* @type {Array.}
*/
this._loaded = [];
/**
* Event handlers.
* @protected
* @type {Object}
*/
this._handlers = {
'initialized.owl.carousel change.owl.carousel': $.proxy(function(e) {
if (!e.namespace) {
return;
}
if (!this._core.settings || !this._core.settings.lazyLoad) {
return;
}
if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
var settings = this._core.settings,
n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
i = ((settings.center && n * -1) || 0),
position = ((e.property && e.property.value) || this._core.current()) + i,
clones = this._core.clones().length,
load = $.proxy(function(i, v) { this.load(v) }, this);
while (i++ < n) {
this.load(clones / 2 + this._core.relative(position));
clones && $.each(this._core.clones(this._core.relative(position++)), load);
}
}
}, this)
};
// set the default options
this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
// register event handler
this._core.$element.on(this._handlers);
}
/**
* Default options.
* @public
*/
Lazy.Defaults = {
lazyLoad: false
}
/**
* Loads all resources of an item at the specified position.
* @param {Number} position - The absolute position of the item.
* @protected
*/
Lazy.prototype.load = function(position) {
var $item = this._core.$stage.children().eq(position),
$elements = $item && $item.find('.owl-lazy');
if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
return;
}
$elements.each($.proxy(function(index, element) {
var $element = $(element), image,
url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src');
this._core.trigger('load', { element: $element, url: url }, 'lazy');
if ($element.is('img')) {
$element.one('load.owl.lazy', $.proxy(function() {
$element.css('opacity', 1);
this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
}, this)).attr('src', url);
} else {
image = new Image();
image.onload = $.proxy(function() {
$element.css({
'background-image': 'url(' + url + ')',
'opacity': '1'
});
this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
}, this);
image.src = url;
}
}, this));
this._loaded.push($item.get(0));
}
/**
* Destroys the plugin.
* @public
*/
Lazy.prototype.destroy = function() {
var handler, property;
for (handler in this.handlers) {
this._core.$element.off(handler, this.handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
}
$.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
})(window.Zepto || window.jQuery, window, document);
/**
* AutoHeight Plugin
* @version 2.0.0
* @author Bartosz Wojciechowski
* @license The MIT License (MIT)
*/
;(function($, window, document, undefined) {
/**
* Creates the auto height plugin.
* @class The Auto Height Plugin
* @param {Owl} carousel - The Owl Carousel
*/
var AutoHeight = function(carousel) {
/**
* Reference to the core.
* @protected
* @type {Owl}
*/
this._core = carousel;
/**
* All event handlers.
* @protected
* @type {Object}
*/
this._handlers = {
'initialized.owl.carousel': $.proxy(function() {
if (this._core.settings.autoHeight) {
this.update();
}
}, this),
'changed.owl.carousel': $.proxy(function(e) {
if (this._core.settings.autoHeight && e.property.name == 'position'){
this.update();
}
}, this),
'loaded.owl.lazy': $.proxy(function(e) {
if (this._core.settings.autoHeight && e.element.closest('.' + this._core.settings.itemClass)
=== this._core.$stage.children().eq(this._core.current())) {
this.update();
}
}, this)
};
// set default options
this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
// register event handlers
this._core.$element.on(this._handlers);
};
/**
* Default options.
* @public
*/
AutoHeight.Defaults = {
autoHeight: false,
autoHeightClass: 'owl-height'
};
/**
* Updates the view.
*/
AutoHeight.prototype.update = function() {
this._core.$stage.parent()
.height(this._core.$stage.children().eq(this._core.current()).height())
.addClass(this._core.settings.autoHeightClass);
};
AutoHeight.prototype.destroy = function() {
var handler, property;
for (handler in this._handlers) {
this._core.$element.off(handler, this._handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
};
$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
})(window.Zepto || window.jQuery, window, document);
/**
* Video Plugin
* @version 2.0.0
* @author Bartosz Wojciechowski
* @license The MIT License (MIT)
*/
;(function($, window, document, undefined) {
/**
* Creates the video plugin.
* @class The Video Plugin
* @param {Owl} carousel - The Owl Carousel
*/
var Video = function(carousel) {
/**
* Reference to the core.
* @protected
* @type {Owl}
*/
this._core = carousel;
/**
* Cache all video URLs.
* @protected
* @type {Object}
*/
this._videos = {};
/**
* Current playing item.
* @protected
* @type {jQuery}
*/
this._playing = null;
/**
* Whether this is in fullscreen or not.
* @protected
* @type {Boolean}
*/
this._fullscreen = false;
/**
* All event handlers.
* @protected
* @type {Object}
*/
this._handlers = {
'resize.owl.carousel': $.proxy(function(e) {
if (this._core.settings.video && !this.isInFullScreen()) {
e.preventDefault();
}
}, this),
'refresh.owl.carousel changed.owl.carousel': $.proxy(function(e) {
if (this._playing) {
this.stop();
}
}, this),
'prepared.owl.carousel': $.proxy(function(e) {
var $element = $(e.content).find('.owl-video');
if ($element.length) {
$element.css('display', 'none');
this.fetch($element, $(e.content));
}
}, this)
};
// set default options
this._core.options = $.extend({}, Video.Defaults, this._core.options);
// register event handlers
this._core.$element.on(this._handlers);
this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
this.play(e);
}, this));
};
/**
* Default options.
* @public
*/
Video.Defaults = {
video: false,
videoHeight: false,
videoWidth: false
};
/**
* Gets the video ID and the type (YouTube/Vimeo only).
* @protected
* @param {jQuery} target - The target containing the video data.
* @param {jQuery} item - The item containing the video.
*/
Video.prototype.fetch = function(target, item) {
var type = target.attr('data-vimeo-id') ? 'vimeo' : 'youtube',
id = target.attr('data-vimeo-id') || target.attr('data-youtube-id'),
width = target.attr('data-width') || this._core.settings.videoWidth,
height = target.attr('data-height') || this._core.settings.videoHeight,
url = target.attr('href');
if (url) {
id = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
if (id[3].indexOf('youtu') > -1) {
type = 'youtube';
} else if (id[3].indexOf('vimeo') > -1) {
type = 'vimeo';
} else {
throw new Error('Video URL not supported.');
}
id = id[6];
} else {
throw new Error('Missing video URL.');
}
this._videos[url] = {
type: type,
id: id,
width: width,
height: height
};
item.attr('data-video', url);
this.thumbnail(target, this._videos[url]);
};
/**
* Creates video thumbnail.
* @protected
* @param {jQuery} target - The target containing the video data.
* @param {Object} info - The video info object.
* @see `fetch`
*/
Video.prototype.thumbnail = function(target, video) {
var tnLink,
icon,
path,
dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '',
customTn = target.find('img'),
srcType = 'src',
lazyClass = '',
settings = this._core.settings,
create = function(path) {
icon = '';
if (settings.lazyLoad) {
tnLink = '';
} else {
tnLink = '';
}
target.after(tnLink);
target.after(icon);
};
// wrap video content into owl-video-wrapper div
target.wrap('');
if (this._core.settings.lazyLoad) {
srcType = 'data-src';
lazyClass = 'owl-lazy';
}
// custom thumbnail
if (customTn.length) {
create(customTn.attr(srcType));
customTn.remove();
return false;
}
if (video.type === 'youtube') {
path = "http://img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
create(path);
} else if (video.type === 'vimeo') {
$.ajax({
type: 'GET',
url: 'http://vimeo.com/api/v2/video/' + video.id + '.json',
jsonp: 'callback',
dataType: 'jsonp',
success: function(data) {
path = data[0].thumbnail_large;
create(path);
}
});
}
};
/**
* Stops the current video.
* @public
*/
Video.prototype.stop = function() {
this._core.trigger('stop', null, 'video');
this._playing.find('.owl-video-frame').remove();
this._playing.removeClass('owl-video-playing');
this._playing = null;
};
/**
* Starts the current video.
* @public
* @param {Event} ev - The event arguments.
*/
Video.prototype.play = function(ev) {
this._core.trigger('play', null, 'video');
if (this._playing) {
this.stop();
}
var target = $(ev.target || ev.srcElement),
item = target.closest('.' + this._core.settings.itemClass),
video = this._videos[item.attr('data-video')],
width = video.width || '100%',
height = video.height || this._core.$stage.height(),
html, wrap;
if (video.type === 'youtube') {
html = '';
} else if (video.type === 'vimeo') {
html = '';
}
item.addClass('owl-video-playing');
this._playing = item;
wrap = $(''
+ html + '
');
target.after(wrap);
};
/**
* Checks whether an video is currently in full screen mode or not.
* @todo Bad style because looks like a readonly method but changes members.
* @protected
* @returns {Boolean}
*/
Video.prototype.isInFullScreen = function() {
// if Vimeo Fullscreen mode
var element = document.fullscreenElement || document.mozFullScreenElement
|| document.webkitFullscreenElement;
if (element && $(element).parent().hasClass('owl-video-frame')) {
this._core.speed(0);
this._fullscreen = true;
}
if (element && this._fullscreen && this._playing) {
return false;
}
// comming back from fullscreen
if (this._fullscreen) {
this._fullscreen = false;
return false;
}
// check full screen mode and window orientation
if (this._playing) {
if (this._core.state.orientation !== window.orientation) {
this._core.state.orientation = window.orientation;
return false;
}
}
return true;
};
/**
* Destroys the plugin.
*/
Video.prototype.destroy = function() {
var handler, property;
this._core.$element.off('click.owl.video');
for (handler in this._handlers) {
this._core.$element.off(handler, this._handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
};
$.fn.owlCarousel.Constructor.Plugins.Video = Video;
})(window.Zepto || window.jQuery, window, document);
/**
* Animate Plugin
* @version 2.0.0
* @author Bartosz Wojciechowski
* @license The MIT License (MIT)
*/
;(function($, window, document, undefined) {
/**
* Creates the animate plugin.
* @class The Navigation Plugin
* @param {Owl} scope - The Owl Carousel
*/
var Animate = function(scope) {
this.core = scope;
this.core.options = $.extend({}, Animate.Defaults, this.core.options);
this.swapping = true;
this.previous = undefined;
this.next = undefined;
this.handlers = {
'change.owl.carousel': $.proxy(function(e) {
if (e.property.name == 'position') {
this.previous = this.core.current();
this.next = e.property.value;
}
}, this),
'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
this.swapping = e.type == 'translated';
}, this),
'translate.owl.carousel': $.proxy(function(e) {
if (this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
this.swap();
}
}, this)
};
this.core.$element.on(this.handlers);
};
/**
* Default options.
* @public
*/
Animate.Defaults = {
animateOut: false,
animateIn: false
};
/**
* Toggles the animation classes whenever an translations starts.
* @protected
* @returns {Boolean|undefined}
*/
Animate.prototype.swap = function() {
if (this.core.settings.items !== 1 || !this.core.support3d) {
return;
}
this.core.speed(0);
var left,
clear = $.proxy(this.clear, this),
previous = this.core.$stage.children().eq(this.previous),
next = this.core.$stage.children().eq(this.next),
incoming = this.core.settings.animateIn,
outgoing = this.core.settings.animateOut;
if (this.core.current() === this.previous) {
return;
}
if (outgoing) {
left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
previous.css( { 'left': left + 'px' } )
.addClass('animated owl-animated-out')
.addClass(outgoing)
.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
}
if (incoming) {
next.addClass('animated owl-animated-in')
.addClass(incoming)
.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
}
};
Animate.prototype.clear = function(e) {
$(e.target).css( { 'left': '' } )
.removeClass('animated owl-animated-out owl-animated-in')
.removeClass(this.core.settings.animateIn)
.removeClass(this.core.settings.animateOut);
this.core.transitionEnd();
}
/**
* Destroys the plugin.
* @public
*/
Animate.prototype.destroy = function() {
var handler, property;
for (handler in this.handlers) {
this.core.$element.off(handler, this.handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
};
$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
})(window.Zepto || window.jQuery, window, document);
/**
* Autoplay Plugin
* @version 2.0.0
* @author Bartosz Wojciechowski
* @license The MIT License (MIT)
*/
;(function($, window, document, undefined) {
/**
* Creates the autoplay plugin.
* @class The Autoplay Plugin
* @param {Owl} scope - The Owl Carousel
*/
var Autoplay = function(scope) {
this.core = scope;
this.core.options = $.extend({}, Autoplay.Defaults, this.core.options);
this.handlers = {
'translated.owl.carousel refreshed.owl.carousel': $.proxy(function() {
this.autoplay();
}, this),
'play.owl.autoplay': $.proxy(function(e, t, s) {
this.play(t, s);
}, this),
'stop.owl.autoplay': $.proxy(function() {
this.stop();
}, this),
'mouseover.owl.autoplay': $.proxy(function() {
if (this.core.settings.autoplayHoverPause) {
this.pause();
}
}, this),
'mouseleave.owl.autoplay': $.proxy(function() {
if (this.core.settings.autoplayHoverPause) {
this.autoplay();
}
}, this)
};
this.core.$element.on(this.handlers);
};
/**
* Default options.
* @public
*/
Autoplay.Defaults = {
autoplay: false,
autoplayTimeout: 5000,
autoplayHoverPause: false,
autoplaySpeed: false
};
/**
* @protected
* @todo Must be documented.
*/
Autoplay.prototype.autoplay = function() {
if (this.core.settings.autoplay && !this.core.state.videoPlay) {
window.clearInterval(this.interval);
this.interval = window.setInterval($.proxy(function() {
this.play();
}, this), this.core.settings.autoplayTimeout);
} else {
window.clearInterval(this.interval);
}
};
/**
* Starts the autoplay.
* @public
* @param {Number} [timeout] - ...
* @param {Number} [speed] - ...
* @returns {Boolean|undefined} - ...
* @todo Must be documented.
*/
Autoplay.prototype.play = function(timeout, speed) {
// if tab is inactive - doesnt work in }
*/
this._templates = [];
/**
* The carousel element.
* @type {jQuery}
*/
this.$element = this._core.$element;
/**
* Overridden methods of the carousel.
* @protected
* @type {Object}
*/
this._overrides = {
next: this._core.next,
prev: this._core.prev,
to: this._core.to
};
/**
* All event handlers.
* @protected
* @type {Object}
*/
this._handlers = {
'prepared.owl.carousel': $.proxy(function(e) {
if (this._core.settings.dotsData) {
this._templates.push($(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
}
}, this),
'add.owl.carousel': $.proxy(function(e) {
if (this._core.settings.dotsData) {
this._templates.splice(e.position, 0, $(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
}
}, this),
'remove.owl.carousel prepared.owl.carousel': $.proxy(function(e) {
if (this._core.settings.dotsData) {
this._templates.splice(e.position, 1);
}
}, this),
'change.owl.carousel': $.proxy(function(e) {
if (e.property.name == 'position') {
if (!this._core.state.revert && !this._core.settings.loop && this._core.settings.navRewind) {
var current = this._core.current(),
maximum = this._core.maximum(),
minimum = this._core.minimum();
e.data = e.property.value > maximum
? current >= maximum ? minimum : maximum
: e.property.value < minimum ? maximum : e.property.value;
}
}
}, this),
'changed.owl.carousel': $.proxy(function(e) {
if (e.property.name == 'position') {
this.draw();
}
}, this),
'refreshed.owl.carousel': $.proxy(function() {
if (!this._initialized) {
this.initialize();
this._initialized = true;
}
this._core.trigger('refresh', null, 'navigation');
this.update();
this.draw();
this._core.trigger('refreshed', null, 'navigation');
}, this)
};
// set default options
this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
// register event handlers
this.$element.on(this._handlers);
}
/**
* Default options.
* @public
* @todo Rename `slideBy` to `navBy`
*/
Navigation.Defaults = {
nav: false,
navRewind: true,
navText: [ 'prev', 'next' ],
navSpeed: false,
navElement: 'div',
navContainer: false,
navContainerClass: 'owl-nav',
navClass: [ 'owl-prev', 'owl-next' ],
slideBy: 1,
dotClass: 'owl-dot',
dotsClass: 'owl-dots',
dots: true,
dotsEach: true,
dotData: false,
dotsSpeed: false,
dotsContainer: false,
controlsClass: 'owl-controls'
}
/**
* Initializes the layout of the plugin and extends the carousel.
* @protected
*/
Navigation.prototype.initialize = function() {
var $container, override,
options = this._core.settings;
// create the indicator template
if (!options.dotsData) {
this._templates = [ $('')
.addClass(options.dotClass)
.append($('
'))
.prop('outerHTML') ];
}
// create controls container if needed
if (!options.navContainer || !options.dotsContainer) {
this._controls.$container = $('')
.addClass(options.controlsClass)
.appendTo(this.$element);
}
// create DOM structure for absolute navigation
this._controls.$indicators = options.dotsContainer ? $(options.dotsContainer)
: $('
').hide().addClass(options.dotsClass).appendTo(this._controls.$container);
this._controls.$indicators.on('click', 'div', $.proxy(function(e) {
var index = $(e.target).parent().is(this._controls.$indicators)
? $(e.target).index() : $(e.target).parent().index();
e.preventDefault();
this.to(index, options.dotsSpeed);
}, this));
// create DOM structure for relative navigation
$container = options.navContainer ? $(options.navContainer)
: $('
').addClass(options.navContainerClass).prependTo(this._controls.$container);
this._controls.$next = $('<' + options.navElement + '>');
this._controls.$previous = this._controls.$next.clone();
this._controls.$previous
.addClass(options.navClass[0])
.html(options.navText[0])
.hide()
.prependTo($container)
.on('click', $.proxy(function(e) {
this.prev(options.navSpeed);
}, this));
this._controls.$next
.addClass(options.navClass[1])
.html(options.navText[1])
.hide()
.appendTo($container)
.on('click', $.proxy(function(e) {
this.next(options.navSpeed);
}, this));
// override public methods of the carousel
for (override in this._overrides) {
this._core[override] = $.proxy(this[override], this);
}
}
/**
* Destroys the plugin.
* @protected
*/
Navigation.prototype.destroy = function() {
var handler, control, property, override;
for (handler in this._handlers) {
this.$element.off(handler, this._handlers[handler]);
}
for (control in this._controls) {
this._controls[control].remove();
}
for (override in this.overides) {
this._core[override] = this._overrides[override];
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
}
/**
* Updates the internal state.
* @protected
*/
Navigation.prototype.update = function() {
var i, j, k,
options = this._core.settings,
lower = this._core.clones().length / 2,
upper = lower + this._core.items().length,
size = options.center || options.autoWidth || options.dotData
? 1 : options.dotsEach || options.items;
if (options.slideBy !== 'page') {
options.slideBy = Math.min(options.slideBy, options.items);
}
if (options.dots || options.slideBy == 'page') {
this._pages = [];
for (i = lower, j = 0, k = 0; i < upper; i++) {
if (j >= size || j === 0) {
this._pages.push({
start: i - lower,
end: i - lower + size - 1
});
j = 0, ++k;
}
j += this._core.mergers(this._core.relative(i));
}
}
}
/**
* Draws the user interface.
* @todo The option `dotData` wont work.
* @protected
*/
Navigation.prototype.draw = function() {
var difference, i, html = '',
options = this._core.settings,
$items = this._core.$stage.children(),
index = this._core.relative(this._core.current());
if (options.nav && !options.loop && !options.navRewind) {
this._controls.$previous.toggleClass('disabled', index <= 0);
this._controls.$next.toggleClass('disabled', index >= this._core.maximum());
}
this._controls.$previous.toggle(options.nav);
this._controls.$next.toggle(options.nav);
if (options.dots) {
difference = this._pages.length - this._controls.$indicators.children().length;
if (options.dotData && difference !== 0) {
for (i = 0; i < this._controls.$indicators.children().length; i++) {
html += this._templates[this._core.relative(i)];
}
this._controls.$indicators.html(html);
} else if (difference > 0) {
html = new Array(difference + 1).join(this._templates[0]);
this._controls.$indicators.append(html);
} else if (difference < 0) {
this._controls.$indicators.children().slice(difference).remove();
}
this._controls.$indicators.find('.active').removeClass('active');
this._controls.$indicators.children().eq($.inArray(this.current(), this._pages)).addClass('active');
}
this._controls.$indicators.toggle(options.dots);
}
/**
* Extends event data.
* @protected
* @param {Event} event - The event object which gets thrown.
*/
Navigation.prototype.onTrigger = function(event) {
var settings = this._core.settings;
event.page = {
index: $.inArray(this.current(), this._pages),
count: this._pages.length,
size: settings && (settings.center || settings.autoWidth || settings.dotData
? 1 : settings.dotsEach || settings.items)
};
}
/**
* Gets the current page position of the carousel.
* @protected
* @returns {Number}
*/
Navigation.prototype.current = function() {
var index = this._core.relative(this._core.current());
return $.grep(this._pages, function(o) {
return o.start <= index && o.end >= index;
}).pop();
}
/**
* Gets the current succesor/predecessor position.
* @protected
* @returns {Number}
*/
Navigation.prototype.getPosition = function(successor) {
var position, length,
options = this._core.settings;
if (options.slideBy == 'page') {
position = $.inArray(this.current(), this._pages);
length = this._pages.length;
successor ? ++position : --position;
position = this._pages[((position % length) + length) % length].start;
} else {
position = this._core.relative(this._core.current());
length = this._core.items().length;
successor ? position += options.slideBy : position -= options.slideBy;
}
return position;
}
/**
* Slides to the next item or page.
* @public
* @param {Number} [speed=false] - The time in milliseconds for the transition.
*/
Navigation.prototype.next = function(speed) {
$.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
}
/**
* Slides to the previous item or page.
* @public
* @param {Number} [speed=false] - The time in milliseconds for the transition.
*/
Navigation.prototype.prev = function(speed) {
$.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
}
/**
* Slides to the specified item or page.
* @public
* @param {Number} position - The position of the item or page.
* @param {Number} [speed] - The time in milliseconds for the transition.
* @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
*/
Navigation.prototype.to = function(position, speed, standard) {
var length;
if (!standard) {
length = this._pages.length;
$.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
} else {
$.proxy(this._overrides.to, this._core)(position, speed);
}
}
$.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
})(window.Zepto || window.jQuery, window, document);
/**
* Hash Plugin
* @version 2.0.0
* @author Artus Kolanowski
* @license The MIT License (MIT)
*/
;(function($, window, document, undefined) {
'use strict';
/**
* Creates the hash plugin.
* @class The Hash Plugin
* @param {Owl} carousel - The Owl Carousel
*/
var Hash = function(carousel) {
/**
* Reference to the core.
* @protected
* @type {Owl}
*/
this._core = carousel;
/**
* Hash table for the hashes.
* @protected
* @type {Object}
*/
this._hashes = {};
/**
* The carousel element.
* @type {jQuery}
*/
this.$element = this._core.$element;
/**
* All event handlers.
* @protected
* @type {Object}
*/
this._handlers = {
'initialized.owl.carousel': $.proxy(function() {
if (this._core.settings.startPosition == 'URLHash') {
$(window).trigger('hashchange.owl.navigation');
}
}, this),
'prepared.owl.carousel': $.proxy(function(e) {
var hash = $(e.content).find('[data-hash]').andSelf('[data-hash]').attr('data-hash');
this._hashes[hash] = e.content;
}, this)
};
// set default options
this._core.options = $.extend({}, Hash.Defaults, this._core.options);
// register the event handlers
this.$element.on(this._handlers);
// register event listener for hash navigation
$(window).on('hashchange.owl.navigation', $.proxy(function() {
var hash = window.location.hash.substring(1),
items = this._core.$stage.children(),
position = this._hashes[hash] && items.index(this._hashes[hash]) || 0;
if (!hash) {
return false;
}
this._core.to(position, false, true);
}, this));
}
/**
* Default options.
* @public
*/
Hash.Defaults = {
URLhashListener: false
}
/**
* Destroys the plugin.
* @public
*/
Hash.prototype.destroy = function() {
var handler, property;
$(window).off('hashchange.owl.navigation');
for (handler in this._handlers) {
this._core.$element.off(handler, this._handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
}
$.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
})(window.Zepto || window.jQuery, window, document);
// source --> http://www.mbsjets.com/wp-content/themes/sports-club/counter/js/jquery.counterup.min.js?ver=4.8.19
/*!
* jquery.counterup.js 1.0
*
* Copyright 2013, Benjamin Intal http://gambit.ph @bfintal
* Released under the GPL v2 License
*
* Date: Nov 26, 2013
*/(function(e){"use strict";e.fn.counterUp=function(t){var n=e.extend({time:400,delay:10},t);return this.each(function(){var t=e(this),r=n,i=function(){var e=[],n=r.time/r.delay,i=t.text(),s=/[0-9]+,[0-9]+/.test(i);i=i.replace(/,/g,"");var o=/^[0-9]+$/.test(i),u=/^[0-9]+\.[0-9]+$/.test(i),a=u?(i.split(".")[1]||[]).length:0;for(var f=n;f>=1;f--){var l=parseInt(i/n*f);u&&(l=parseFloat(i/n*f).toFixed(a));if(s)while(/(\d+)(\d{3})/.test(l.toString()))l=l.toString().replace(/(\d+)(\d{3})/,"$1,$2");e.unshift(l)}t.data("counterup-nums",e);t.text("0");var c=function(){t.text(t.data("counterup-nums").shift());if(t.data("counterup-nums").length)setTimeout(t.data("counterup-func"),r.delay);else{delete t.data("counterup-nums");t.data("counterup-nums",null);t.data("counterup-func",null)}};t.data("counterup-func",c);setTimeout(t.data("counterup-func"),r.delay)};t.waypoint(i,{offset:"100%",triggerOnce:!0})})}})(jQuery);
// source --> http://www.mbsjets.com/wp-content/themes/sports-club/counter/js/waypoints.min.js?ver=4.8.19
// Generated by CoffeeScript 1.6.2
/*
jQuery Waypoints - v2.0.3
Copyright (c) 2011-2013 Caleb Troughton
Dual licensed under the MIT license and GPL license.
https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
*/
(function(){var t=[].indexOf||function(t){for(var e=0,n=this.length;e
=0;s={horizontal:{},vertical:{}};f=1;a={};u="waypoints-context-id";p="resize.waypoints";y="scroll.waypoints";v=1;w="waypoints-waypoint-ids";g="waypoint";m="waypoints";o=function(){function t(t){var e=this;this.$element=t;this.element=t[0];this.didResize=false;this.didScroll=false;this.id="context"+f++;this.oldScroll={x:t.scrollLeft(),y:t.scrollTop()};this.waypoints={horizontal:{},vertical:{}};t.data(u,this.id);a[this.id]=this;t.bind(y,function(){var t;if(!(e.didScroll||c)){e.didScroll=true;t=function(){e.doScroll();return e.didScroll=false};return r.setTimeout(t,n[m].settings.scrollThrottle)}});t.bind(p,function(){var t;if(!e.didResize){e.didResize=true;t=function(){n[m]("refresh");return e.didResize=false};return r.setTimeout(t,n[m].settings.resizeThrottle)}})}t.prototype.doScroll=function(){var t,e=this;t={horizontal:{newScroll:this.$element.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.$element.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};if(c&&(!t.vertical.oldScroll||!t.vertical.newScroll)){n[m]("refresh")}n.each(t,function(t,r){var i,o,l;l=[];o=r.newScroll>r.oldScroll;i=o?r.forward:r.backward;n.each(e.waypoints[t],function(t,e){var n,i;if(r.oldScroll<(n=e.offset)&&n<=r.newScroll){return l.push(e)}else if(r.newScroll<(i=e.offset)&&i<=r.oldScroll){return l.push(e)}});l.sort(function(t,e){return t.offset-e.offset});if(!o){l.reverse()}return n.each(l,function(t,e){if(e.options.continuous||t===l.length-1){return e.trigger([i])}})});return this.oldScroll={x:t.horizontal.newScroll,y:t.vertical.newScroll}};t.prototype.refresh=function(){var t,e,r,i=this;r=n.isWindow(this.element);e=this.$element.offset();this.doScroll();t={horizontal:{contextOffset:r?0:e.left,contextScroll:r?0:this.oldScroll.x,contextDimension:this.$element.width(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:r?0:e.top,contextScroll:r?0:this.oldScroll.y,contextDimension:r?n[m]("viewportHeight"):this.$element.height(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};return n.each(t,function(t,e){return n.each(i.waypoints[t],function(t,r){var i,o,l,s,f;i=r.options.offset;l=r.offset;o=n.isWindow(r.element)?0:r.$element.offset()[e.offsetProp];if(n.isFunction(i)){i=i.apply(r.element)}else if(typeof i==="string"){i=parseFloat(i);if(r.options.offset.indexOf("%")>-1){i=Math.ceil(e.contextDimension*i/100)}}r.offset=o-e.contextOffset+e.contextScroll-i;if(r.options.onlyOnScroll&&l!=null||!r.enabled){return}if(l!==null&&l<(s=e.oldScroll)&&s<=r.offset){return r.trigger([e.backward])}else if(l!==null&&l>(f=e.oldScroll)&&f>=r.offset){return r.trigger([e.forward])}else if(l===null&&e.oldScroll>=r.offset){return r.trigger([e.forward])}})})};t.prototype.checkEmpty=function(){if(n.isEmptyObject(this.waypoints.horizontal)&&n.isEmptyObject(this.waypoints.vertical)){this.$element.unbind([p,y].join(" "));return delete a[this.id]}};return t}();l=function(){function t(t,e,r){var i,o;r=n.extend({},n.fn[g].defaults,r);if(r.offset==="bottom-in-view"){r.offset=function(){var t;t=n[m]("viewportHeight");if(!n.isWindow(e.element)){t=e.$element.height()}return t-n(this).outerHeight()}}this.$element=t;this.element=t[0];this.axis=r.horizontal?"horizontal":"vertical";this.callback=r.handler;this.context=e;this.enabled=r.enabled;this.id="waypoints"+v++;this.offset=null;this.options=r;e.waypoints[this.axis][this.id]=this;s[this.axis][this.id]=this;i=(o=t.data(w))!=null?o:[];i.push(this.id);t.data(w,i)}t.prototype.trigger=function(t){if(!this.enabled){return}if(this.callback!=null){this.callback.apply(this.element,t)}if(this.options.triggerOnce){return this.destroy()}};t.prototype.disable=function(){return this.enabled=false};t.prototype.enable=function(){this.context.refresh();return this.enabled=true};t.prototype.destroy=function(){delete s[this.axis][this.id];delete this.context.waypoints[this.axis][this.id];return this.context.checkEmpty()};t.getWaypointsByElement=function(t){var e,r;r=n(t).data(w);if(!r){return[]}e=n.extend({},s.horizontal,s.vertical);return n.map(r,function(t){return e[t]})};return t}();d={init:function(t,e){var r;if(e==null){e={}}if((r=e.handler)==null){e.handler=t}this.each(function(){var t,r,i,s;t=n(this);i=(s=e.context)!=null?s:n.fn[g].defaults.context;if(!n.isWindow(i)){i=t.closest(i)}i=n(i);r=a[i.data(u)];if(!r){r=new o(i)}return new l(t,r,e)});n[m]("refresh");return this},disable:function(){return d._invoke(this,"disable")},enable:function(){return d._invoke(this,"enable")},destroy:function(){return d._invoke(this,"destroy")},prev:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(e>0){return t.push(n[e-1])}})},next:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(et.oldScroll.y})},left:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset<=t.oldScroll.x})},right:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset>t.oldScroll.x})},enable:function(){return h._invoke("enable")},disable:function(){return h._invoke("disable")},destroy:function(){return h._invoke("destroy")},extendFn:function(t,e){return d[t]=e},_invoke:function(t){var e;e=n.extend({},s.vertical,s.horizontal);return n.each(e,function(e,n){n[t]();return true})},_filter:function(t,e,r){var i,o;i=a[n(t).data(u)];if(!i){return[]}o=[];n.each(i.waypoints[e],function(t,e){if(r(i,e)){return o.push(e)}});o.sort(function(t,e){return t.offset-e.offset});return n.map(o,function(t){return t.element})}};n[m]=function(){var t,n;n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[];if(h[n]){return h[n].apply(null,t)}else{return h.aggregate.call(null,n)}};n[m].settings={resizeThrottle:100,scrollThrottle:30};return i.load(function(){return n[m]("refresh")})})}).call(this);
// source --> http://www.mbsjets.com/wp-content/themes/sports-club/mixitup/jquery_013.js?ver=4.8.19
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-csstransforms-csstransforms3d-csstransitions-shiv-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes-load
*/
;window.Modernizr=function(a,b,c){function z(a){j.cssText=a}function A(a,b){return z(m.join(a+";")+(b||""))}function B(a,b){return typeof a===b}function C(a,b){return!!~(""+a).indexOf(b)}function D(a,b){for(var d in a){var e=a[d];if(!C(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return B(b,"string")||B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["",'"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x={}.hasOwnProperty,y;!B(x,"undefined")&&!B(x.call,"undefined")?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.csstransforms=function(){return!!F("transform")},q.csstransforms3d=function(){var a=!!F("perspective");return a&&"webkitPerspective"in g.style&&w("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},q.csstransitions=function(){return F("transition")};for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)y(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},z(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return D([a])},e.testAllProps=F,e.testStyles=w,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f http://www.mbsjets.com/wp-content/themes/sports-club/mixitup/jquery_003.js?ver=4.8.19
/**
* Isotope v1.5.20
*/
(function( window, $, undefined ){
'use strict';
// get global vars
var document = window.document;
var Modernizr = window.Modernizr;
// helper function
var capitalize = function( str ) {
return str.charAt(0).toUpperCase() + str.slice(1);
};
// ========================= getStyleProperty by kangax ===============================
// http://perfectionkills.com/feature-testing-css-properties/
var prefixes = 'Moz Webkit O Ms'.split(' ');
var getStyleProperty = function( propName ) {
var style = document.documentElement.style,
prefixed;
// test standard property first
if ( typeof style[propName] === 'string' ) {
return propName;
}
// capitalize
propName = capitalize( propName );
// test vendor specific properties
for ( var i=0, len = prefixes.length; i < len; i++ ) {
prefixed = prefixes[i] + propName;
if ( typeof style[ prefixed ] === 'string' ) {
return prefixed;
}
}
};
var transformProp = getStyleProperty('transform'),
transitionProp = getStyleProperty('transitionProperty');
if ( Modernizr.csstransforms ) {
// i.e. transformFnNotations.scale(0.5) >> 'scale3d( 0.5, 0.5, 1)'
var transformFnNotations = Modernizr.csstransforms3d ?
{ // 3D transform functions
translate : function ( position ) {
return 'translate3d(' + position[0] + 'px, ' + position[1] + 'px, 0) ';
},
scale : function ( scale ) {
return 'scale3d(' + scale + ', ' + scale + ', 1) ';
}
} :
{ // 2D transform functions
translate : function ( position ) {
return 'translate(' + position[0] + 'px, ' + position[1] + 'px) ';
},
scale : function ( scale ) {
return 'scale(' + scale + ') ';
}
}
;
var setIsoTransform = function ( elem, name, value ) {
// unpack current transform data
var data = $.data( elem, 'isoTransform' ) || {},
newData = {},
fnName,
transformObj = {},
transformValue;
// i.e. newData.scale = 0.5
newData[ name ] = value;
// extend new value over current data
$.extend( data, newData );
for ( fnName in data ) {
transformValue = data[ fnName ];
transformObj[ fnName ] = transformFnNotations[ fnName ]( transformValue );
}
// get proper order
// ideally, we could loop through this give an array, but since we only have
// a couple transforms we're keeping track of, we'll do it like so
var translateFn = transformObj.translate || '',
scaleFn = transformObj.scale || '',
// sorting so translate always comes first
valueFns = translateFn + scaleFn;
// set data back in elem
$.data( elem, 'isoTransform', data );
// set name to vendor specific property
elem.style[ transformProp ] = valueFns;
};
// ==================== scale ===================
$.cssNumber.scale = true;
$.cssHooks.scale = {
set: function( elem, value ) {
// uncomment this bit if you want to properly parse strings
// if ( typeof value === 'string' ) {
// value = parseFloat( value );
// }
setIsoTransform( elem, 'scale', value );
},
get: function( elem, computed ) {
var transform = $.data( elem, 'isoTransform' );
return transform && transform.scale ? transform.scale : 1;
}
};
$.fx.step.scale = function( fx ) {
$.cssHooks.scale.set( fx.elem, fx.now+fx.unit );
};
// ==================== translate ===================
$.cssNumber.translate = true;
$.cssHooks.translate = {
set: function( elem, value ) {
// uncomment this bit if you want to properly parse strings
// if ( typeof value === 'string' ) {
// value = value.split(' ');
// }
//
// var i, val;
// for ( i = 0; i < 2; i++ ) {
// val = value[i];
// if ( typeof val === 'string' ) {
// val = parseInt( val );
// }
// }
setIsoTransform( elem, 'translate', value );
},
get: function( elem, computed ) {
var transform = $.data( elem, 'isoTransform' );
return transform && transform.translate ? transform.translate : [ 0, 0 ];
}
};
}
// ========================= get transition-end event ===============================
var transitionEndEvent, transitionDurProp;
if ( Modernizr.csstransitions ) {
transitionEndEvent = {
WebkitTransitionProperty: 'webkitTransitionEnd', // webkit
MozTransitionProperty: 'transitionend',
OTransitionProperty: 'oTransitionEnd otransitionend',
transitionProperty: 'transitionend'
}[ transitionProp ];
transitionDurProp = getStyleProperty('transitionDuration');
}
// ========================= smartresize ===============================
/*
* smartresize: debounced resize event for jQuery
*
* latest version and complete README available on Github:
* https://github.com/louisremi/jquery.smartresize.js
*
* Copyright 2011 @louis_remi
* Licensed under the MIT license.
*/
var $event = $.event,
resizeTimeout;
$event.special.smartresize = {
setup: function() {
$(this).bind( "resize", $event.special.smartresize.handler );
},
teardown: function() {
$(this).unbind( "resize", $event.special.smartresize.handler );
},
handler: function( event, execAsap ) {
// Save the context
var context = this,
args = arguments;
// set correct event type
event.type = "smartresize";
if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
resizeTimeout = setTimeout(function() {
jQuery.event.handle.apply( context, args );
}, execAsap === "execAsap"? 0 : 100 );
}
};
$.fn.smartresize = function( fn ) {
return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
};
// ========================= Isotope ===============================
// our "Widget" object constructor
$.Isotope = function( options, element, callback ){
this.element = $( element );
this._create( options );
this._init( callback );
};
// styles of container element we want to keep track of
var isoContainerStyles = [ 'width', 'height' ];
var $window = $(window);
$.Isotope.settings = {
resizable: true,
layoutMode : 'masonry',
containerClass : 'isotope',
itemClass : 'isotope-item',
hiddenClass : 'isotope-hidden',
hiddenStyle: { opacity: 0, scale: 0.001 },
visibleStyle: { opacity: 1, scale: 1 },
containerStyle: {
position: 'relative',
overflow: 'hidden'
},
animationEngine: 'best-available',
animationOptions: {
queue: false,
duration: 800
},
sortBy : 'original-order',
sortAscending : true,
resizesContainer : true,
transformsEnabled: true,
itemPositionDataEnabled: false
};
$.Isotope.prototype = {
// sets up widget
_create : function( options ) {
this.options = $.extend( {}, $.Isotope.settings, options );
this.styleQueue = [];
this.elemCount = 0;
// get original styles in case we re-apply them in .destroy()
var elemStyle = this.element[0].style;
this.originalStyle = {};
// keep track of container styles
var containerStyles = isoContainerStyles.slice(0);
for ( var prop in this.options.containerStyle ) {
containerStyles.push( prop );
}
for ( var i=0, len = containerStyles.length; i < len; i++ ) {
prop = containerStyles[i];
this.originalStyle[ prop ] = elemStyle[ prop ] || '';
}
// apply container style from options
this.element.css( this.options.containerStyle );
this._updateAnimationEngine();
this._updateUsingTransforms();
// sorting
var originalOrderSorter = {
'original-order' : function( $elem, instance ) {
instance.elemCount ++;
return instance.elemCount;
},
random : function() {
return Math.random();
}
};
this.options.getSortData = $.extend( this.options.getSortData, originalOrderSorter );
// need to get atoms
this.reloadItems();
// get top left position of where the bricks should be
this.offset = {
left: parseInt( ( this.element.css('padding-left') || 0 ), 10 ),
top: parseInt( ( this.element.css('padding-top') || 0 ), 10 )
};
// add isotope class first time around
var instance = this;
setTimeout( function() {
instance.element.addClass( instance.options.containerClass );
}, 0 );
// bind resize method
if ( this.options.resizable ) {
$window.bind( 'smartresize.isotope', function() {
instance.resize();
});
}
// dismiss all click events from hidden events
this.element.delegate( '.' + this.options.hiddenClass, 'click', function(){
return false;
});
},
_getAtoms : function( $elems ) {
var selector = this.options.itemSelector,
// filter & find
$atoms = selector ? $elems.filter( selector ).add( $elems.find( selector ) ) : $elems,
// base style for atoms
atomStyle = { position: 'absolute' };
if ( this.usingTransforms ) {
atomStyle.left = 0;
atomStyle.top = 0;
}
$atoms.css( atomStyle ).addClass( this.options.itemClass );
this.updateSortData( $atoms, true );
return $atoms;
},
// _init fires when your instance is first created
// (from the constructor above), and when you
// attempt to initialize the widget again (by the bridge)
// after it has already been initialized.
_init : function( callback ) {
this.$filteredAtoms = this._filter( this.$allAtoms );
this._sort();
this.reLayout( callback );
},
option : function( opts ){
// change options AFTER initialization:
// signature: $('#foo').bar({ cool:false });
if ( $.isPlainObject( opts ) ){
this.options = $.extend( true, this.options, opts );
// trigger _updateOptionName if it exists
var updateOptionFn;
for ( var optionName in opts ) {
updateOptionFn = '_update' + capitalize( optionName );
if ( this[ updateOptionFn ] ) {
this[ updateOptionFn ]();
}
}
}
},
// ====================== updaters ====================== //
// kind of like setters
_updateAnimationEngine : function() {
var animationEngine = this.options.animationEngine.toLowerCase().replace( /[ _\-]/g, '');
var isUsingJQueryAnimation;
// set applyStyleFnName
switch ( animationEngine ) {
case 'css' :
case 'none' :
isUsingJQueryAnimation = false;
break;
case 'jquery' :
isUsingJQueryAnimation = true;
break;
default : // best available
isUsingJQueryAnimation = !Modernizr.csstransitions;
}
this.isUsingJQueryAnimation = isUsingJQueryAnimation;
this._updateUsingTransforms();
},
_updateTransformsEnabled : function() {
this._updateUsingTransforms();
},
_updateUsingTransforms : function() {
var usingTransforms = this.usingTransforms = this.options.transformsEnabled &&
Modernizr.csstransforms && Modernizr.csstransitions && !this.isUsingJQueryAnimation;
// prevent scales when transforms are disabled
if ( !usingTransforms ) {
delete this.options.hiddenStyle.scale;
delete this.options.visibleStyle.scale;
}
this.getPositionStyles = usingTransforms ? this._translate : this._positionAbs;
},
// ====================== Filtering ======================
_filter : function( $atoms ) {
var filter = this.options.filter === '' ? '*' : this.options.filter;
if ( !filter ) {
return $atoms;
}
var hiddenClass = this.options.hiddenClass,
hiddenSelector = '.' + hiddenClass,
$hiddenAtoms = $atoms.filter( hiddenSelector ),
$atomsToShow = $hiddenAtoms;
if ( filter !== '*' ) {
$atomsToShow = $hiddenAtoms.filter( filter );
var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ).addClass( hiddenClass );
this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle });
}
this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle });
$atomsToShow.removeClass( hiddenClass );
return $atoms.filter( filter );
},
// ====================== Sorting ======================
updateSortData : function( $atoms, isIncrementingElemCount ) {
var instance = this,
getSortData = this.options.getSortData,
$this, sortData;
$atoms.each(function(){
$this = $(this);
sortData = {};
// get value for sort data based on fn( $elem ) passed in
for ( var key in getSortData ) {
if ( !isIncrementingElemCount && key === 'original-order' ) {
// keep original order original
sortData[ key ] = $.data( this, 'isotope-sort-data' )[ key ];
} else {
sortData[ key ] = getSortData[ key ]( $this, instance );
}
}
// apply sort data to element
$.data( this, 'isotope-sort-data', sortData );
});
},
// used on all the filtered atoms
_sort : function() {
var sortBy = this.options.sortBy,
getSorter = this._getSorter,
sortDir = this.options.sortAscending ? 1 : -1,
sortFn = function( alpha, beta ) {
var a = getSorter( alpha, sortBy ),
b = getSorter( beta, sortBy );
// fall back to original order if data matches
if ( a === b && sortBy !== 'original-order') {
a = getSorter( alpha, 'original-order' );
b = getSorter( beta, 'original-order' );
}
return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir;
};
this.$filteredAtoms.sort( sortFn );
},
_getSorter : function( elem, sortBy ) {
return $.data( elem, 'isotope-sort-data' )[ sortBy ];
},
// ====================== Layout Helpers ======================
_translate : function( x, y ) {
return { translate : [ x, y ] };
},
_positionAbs : function( x, y ) {
return { left: x, top: y };
},
_pushPosition : function( $elem, x, y ) {
x = Math.round( x + this.offset.left );
y = Math.round( y + this.offset.top );
var position = this.getPositionStyles( x, y );
this.styleQueue.push({ $el: $elem, style: position });
if ( this.options.itemPositionDataEnabled ) {
$elem.data('isotope-item-position', {x: x, y: y} );
}
},
// ====================== General Layout ======================
// used on collection of atoms (should be filtered, and sorted before )
// accepts atoms-to-be-laid-out to start with
layout : function( $elems, callback ) {
var layoutMode = this.options.layoutMode;
// layout logic
this[ '_' + layoutMode + 'Layout' ]( $elems );
// set the size of the container
if ( this.options.resizesContainer ) {
var containerStyle = this[ '_' + layoutMode + 'GetContainerSize' ]();
this.styleQueue.push({ $el: this.element, style: containerStyle });
}
this._processStyleQueue( $elems, callback );
this.isLaidOut = true;
},
_processStyleQueue : function( $elems, callback ) {
// are we animating the layout arrangement?
// use plugin-ish syntax for css or animate
var styleFn = !this.isLaidOut ? 'css' : (
this.isUsingJQueryAnimation ? 'animate' : 'css'
),
animOpts = this.options.animationOptions,
onLayout = this.options.onLayout,
objStyleFn, processor,
triggerCallbackNow, callbackFn;
// default styleQueue processor, may be overwritten down below
processor = function( i, obj ) {
obj.$el[ styleFn ]( obj.style, animOpts );
};
if ( this._isInserting && this.isUsingJQueryAnimation ) {
// if using styleQueue to insert items
processor = function( i, obj ) {
// only animate if it not being inserted
objStyleFn = obj.$el.hasClass('no-transition') ? 'css' : styleFn;
obj.$el[ objStyleFn ]( obj.style, animOpts );
};
} else if ( callback || onLayout || animOpts.complete ) {
// has callback
var isCallbackTriggered = false,
// array of possible callbacks to trigger
callbacks = [ callback, onLayout, animOpts.complete ],
instance = this;
triggerCallbackNow = true;
// trigger callback only once
callbackFn = function() {
if ( isCallbackTriggered ) {
return;
}
var hollaback;
for (var i=0, len = callbacks.length; i < len; i++) {
hollaback = callbacks[i];
if ( typeof hollaback === 'function' ) {
hollaback.call( instance.element, $elems, instance );
}
}
isCallbackTriggered = true;
};
if ( this.isUsingJQueryAnimation && styleFn === 'animate' ) {
// add callback to animation options
animOpts.complete = callbackFn;
triggerCallbackNow = false;
} else if ( Modernizr.csstransitions ) {
// detect if first item has transition
var i = 0,
firstItem = this.styleQueue[0],
testElem = firstItem && firstItem.$el,
styleObj;
// get first non-empty jQ object
while ( !testElem || !testElem.length ) {
styleObj = this.styleQueue[ i++ ];
// HACK: sometimes styleQueue[i] is undefined
if ( !styleObj ) {
return;
}
testElem = styleObj.$el;
}
// get transition duration of the first element in that object
// yeah, this is inexact
var duration = parseFloat( getComputedStyle( testElem[0] )[ transitionDurProp ] );
if ( duration > 0 ) {
processor = function( i, obj ) {
obj.$el[ styleFn ]( obj.style, animOpts )
// trigger callback at transition end
.one( transitionEndEvent, callbackFn );
};
triggerCallbackNow = false;
}
}
}
// process styleQueue
$.each( this.styleQueue, processor );
if ( triggerCallbackNow ) {
callbackFn();
}
// clear out queue for next time
this.styleQueue = [];
},
resize : function() {
if ( this[ '_' + this.options.layoutMode + 'ResizeChanged' ]() ) {
this.reLayout();
}
},
reLayout : function( callback ) {
this[ '_' + this.options.layoutMode + 'Reset' ]();
this.layout( this.$filteredAtoms, callback );
},
// ====================== Convenience methods ======================
// ====================== Adding items ======================
// adds a jQuery object of items to a isotope container
addItems : function( $content, callback ) {
var $newAtoms = this._getAtoms( $content );
// add new atoms to atoms pools
this.$allAtoms = this.$allAtoms.add( $newAtoms );
if ( callback ) {
callback( $newAtoms );
}
},
// convienence method for adding elements properly to any layout
// positions items, hides them, then animates them back in <--- very sezzy
insert : function( $content, callback ) {
// position items
this.element.append( $content );
var instance = this;
this.addItems( $content, function( $newAtoms ) {
var $newFilteredAtoms = instance._filter( $newAtoms );
instance._addHideAppended( $newFilteredAtoms );
instance._sort();
instance.reLayout();
instance._revealAppended( $newFilteredAtoms, callback );
});
},
// convienence method for working with Infinite Scroll
appended : function( $content, callback ) {
var instance = this;
this.addItems( $content, function( $newAtoms ) {
instance._addHideAppended( $newAtoms );
instance.layout( $newAtoms );
instance._revealAppended( $newAtoms, callback );
});
},
// adds new atoms, then hides them before positioning
_addHideAppended : function( $newAtoms ) {
this.$filteredAtoms = this.$filteredAtoms.add( $newAtoms );
$newAtoms.addClass('no-transition');
this._isInserting = true;
// apply hidden styles
this.styleQueue.push({ $el: $newAtoms, style: this.options.hiddenStyle });
},
// sets visible style on new atoms
_revealAppended : function( $newAtoms, callback ) {
var instance = this;
// apply visible style after a sec
setTimeout( function() {
// enable animation
$newAtoms.removeClass('no-transition');
// reveal newly inserted filtered elements
instance.styleQueue.push({ $el: $newAtoms, style: instance.options.visibleStyle });
instance._isInserting = false;
instance._processStyleQueue( $newAtoms, callback );
}, 10 );
},
// gathers all atoms
reloadItems : function() {
this.$allAtoms = this._getAtoms( this.element.children() );
},
// removes elements from Isotope widget
remove: function( $content, callback ) {
// remove elements from Isotope instance in callback
var instance = this;
// remove() as a callback, for after transition / animation
var removeContent = function() {
instance.$allAtoms = instance.$allAtoms.not( $content );
$content.remove();
if ( callback ) {
callback.call( instance.element );
}
};
if ( $content.filter( ':not(.' + this.options.hiddenClass + ')' ).length ) {
// if any non-hidden content needs to be removed
this.styleQueue.push({ $el: $content, style: this.options.hiddenStyle });
this.$filteredAtoms = this.$filteredAtoms.not( $content );
this._sort();
this.reLayout( removeContent );
} else {
// remove it now
removeContent();
}
},
shuffle : function( callback ) {
this.updateSortData( this.$allAtoms );
this.options.sortBy = 'random';
this._sort();
this.reLayout( callback );
},
// destroys widget, returns elements and container back (close) to original style
destroy : function() {
var usingTransforms = this.usingTransforms;
var options = this.options;
this.$allAtoms
.removeClass( options.hiddenClass + ' ' + options.itemClass )
.each(function(){
var style = this.style;
style.position = '';
style.top = '';
style.left = '';
style.opacity = '';
if ( usingTransforms ) {
style[ transformProp ] = '';
}
});
// re-apply saved container styles
var elemStyle = this.element[0].style;
for ( var prop in this.originalStyle ) {
elemStyle[ prop ] = this.originalStyle[ prop ];
}
this.element
.unbind('.isotope')
.undelegate( '.' + options.hiddenClass, 'click' )
.removeClass( options.containerClass )
.removeData('isotope');
$window.unbind('.isotope');
},
// ====================== LAYOUTS ======================
// calculates number of rows or columns
// requires columnWidth or rowHeight to be set on namespaced object
// i.e. this.masonry.columnWidth = 200
_getSegments : function( isRows ) {
var namespace = this.options.layoutMode,
measure = isRows ? 'rowHeight' : 'columnWidth',
size = isRows ? 'height' : 'width',
segmentsName = isRows ? 'rows' : 'cols',
containerSize = this.element[ size ](),
segments,
// i.e. options.masonry && options.masonry.columnWidth
segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] ||
// or use the size of the first item, i.e. outerWidth
this.$filteredAtoms[ 'outer' + capitalize(size) ](true) ||
// if there's no items, use size of container
containerSize;
segments = Math.floor( containerSize / segmentSize );
segments = Math.max( segments, 1 );
// i.e. this.masonry.cols = ....
this[ namespace ][ segmentsName ] = segments;
// i.e. this.masonry.columnWidth = ...
this[ namespace ][ measure ] = segmentSize;
},
_checkIfSegmentsChanged : function( isRows ) {
var namespace = this.options.layoutMode,
segmentsName = isRows ? 'rows' : 'cols',
prevSegments = this[ namespace ][ segmentsName ];
// update cols/rows
this._getSegments( isRows );
// return if updated cols/rows is not equal to previous
return ( this[ namespace ][ segmentsName ] !== prevSegments );
},
// ====================== Masonry ======================
_masonryReset : function() {
// layout-specific props
this.masonry = {};
// FIXME shouldn't have to call this again
this._getSegments();
var i = this.masonry.cols;
this.masonry.colYs = [];
while (i--) {
this.masonry.colYs.push( 0 );
}
},
_masonryLayout : function( $elems ) {
var instance = this,
props = instance.masonry;
$elems.each(function(){
var $this = $(this),
//how many columns does this brick span
colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth );
colSpan = Math.min( colSpan, props.cols );
if ( colSpan === 1 ) {
// if brick spans only one column, just like singleMode
instance._masonryPlaceBrick( $this, props.colYs );
} else {
// brick spans more than one column
// how many different places could this brick fit horizontally
var groupCount = props.cols + 1 - colSpan,
groupY = [],
groupColY,
i;
// for each group potential horizontal position
for ( i=0; i < groupCount; i++ ) {
// make an array of colY values for that one group
groupColY = props.colYs.slice( i, i+colSpan );
// and get the max value of the array
groupY[i] = Math.max.apply( Math, groupColY );
}
instance._masonryPlaceBrick( $this, groupY );
}
});
},
// worker method that places brick in the columnSet
// with the the minY
_masonryPlaceBrick : function( $brick, setY ) {
// get the minimum Y value from the columns
var minimumY = Math.min.apply( Math, setY ),
shortCol = 0;
// Find index of short column, the first from the left
for (var i=0, len = setY.length; i < len; i++) {
if ( setY[i] === minimumY ) {
shortCol = i;
break;
}
}
// position the brick
var x = this.masonry.columnWidth * shortCol,
y = minimumY;
this._pushPosition( $brick, x, y );
// apply setHeight to necessary columns
var setHeight = minimumY + $brick.outerHeight(true),
setSpan = this.masonry.cols + 1 - len;
for ( i=0; i < setSpan; i++ ) {
this.masonry.colYs[ shortCol + i ] = setHeight;
}
},
_masonryGetContainerSize : function() {
var containerHeight = Math.max.apply( Math, this.masonry.colYs );
return { height: containerHeight };
},
_masonryResizeChanged : function() {
return this._checkIfSegmentsChanged();
},
// ====================== fitRows ======================
_fitRowsReset : function() {
this.fitRows = {
x : 0,
y : 0,
height : 0
};
},
_fitRowsLayout : function( $elems ) {
var instance = this,
containerWidth = this.element.width(),
props = this.fitRows;
$elems.each( function() {
var $this = $(this),
atomW = $this.outerWidth(true),
atomH = $this.outerHeight(true);
if ( props.x !== 0 && atomW + props.x > containerWidth ) {
// if this element cannot fit in the current row
props.x = 0;
props.y = props.height;
}
// position the atom
instance._pushPosition( $this, props.x, props.y );
props.height = Math.max( props.y + atomH, props.height );
props.x += atomW;
});
},
_fitRowsGetContainerSize : function () {
return { height : this.fitRows.height };
},
_fitRowsResizeChanged : function() {
return true;
},
// ====================== cellsByRow ======================
_cellsByRowReset : function() {
this.cellsByRow = {
index : 0
};
// get this.cellsByRow.columnWidth
this._getSegments();
// get this.cellsByRow.rowHeight
this._getSegments(true);
},
_cellsByRowLayout : function( $elems ) {
var instance = this,
props = this.cellsByRow;
$elems.each( function(){
var $this = $(this),
col = props.index % props.cols,
row = Math.floor( props.index / props.cols ),
x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
instance._pushPosition( $this, x, y );
props.index ++;
});
},
_cellsByRowGetContainerSize : function() {
return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.offset.top };
},
_cellsByRowResizeChanged : function() {
return this._checkIfSegmentsChanged();
},
// ====================== straightDown ======================
_straightDownReset : function() {
this.straightDown = {
y : 0
};
},
_straightDownLayout : function( $elems ) {
var instance = this;
$elems.each( function( i ){
var $this = $(this);
instance._pushPosition( $this, 0, instance.straightDown.y );
instance.straightDown.y += $this.outerHeight(true);
});
},
_straightDownGetContainerSize : function() {
return { height : this.straightDown.y };
},
_straightDownResizeChanged : function() {
return true;
},
// ====================== masonryHorizontal ======================
_masonryHorizontalReset : function() {
// layout-specific props
this.masonryHorizontal = {};
// FIXME shouldn't have to call this again
this._getSegments( true );
var i = this.masonryHorizontal.rows;
this.masonryHorizontal.rowXs = [];
while (i--) {
this.masonryHorizontal.rowXs.push( 0 );
}
},
_masonryHorizontalLayout : function( $elems ) {
var instance = this,
props = instance.masonryHorizontal;
$elems.each(function(){
var $this = $(this),
//how many rows does this brick span
rowSpan = Math.ceil( $this.outerHeight(true) / props.rowHeight );
rowSpan = Math.min( rowSpan, props.rows );
if ( rowSpan === 1 ) {
// if brick spans only one column, just like singleMode
instance._masonryHorizontalPlaceBrick( $this, props.rowXs );
} else {
// brick spans more than one row
// how many different places could this brick fit horizontally
var groupCount = props.rows + 1 - rowSpan,
groupX = [],
groupRowX, i;
// for each group potential horizontal position
for ( i=0; i < groupCount; i++ ) {
// make an array of colY values for that one group
groupRowX = props.rowXs.slice( i, i+rowSpan );
// and get the max value of the array
groupX[i] = Math.max.apply( Math, groupRowX );
}
instance._masonryHorizontalPlaceBrick( $this, groupX );
}
});
},
_masonryHorizontalPlaceBrick : function( $brick, setX ) {
// get the minimum Y value from the columns
var minimumX = Math.min.apply( Math, setX ),
smallRow = 0;
// Find index of smallest row, the first from the top
for (var i=0, len = setX.length; i < len; i++) {
if ( setX[i] === minimumX ) {
smallRow = i;
break;
}
}
// position the brick
var x = minimumX,
y = this.masonryHorizontal.rowHeight * smallRow;
this._pushPosition( $brick, x, y );
// apply setHeight to necessary columns
var setWidth = minimumX + $brick.outerWidth(true),
setSpan = this.masonryHorizontal.rows + 1 - len;
for ( i=0; i < setSpan; i++ ) {
this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth;
}
},
_masonryHorizontalGetContainerSize : function() {
var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs );
return { width: containerWidth };
},
_masonryHorizontalResizeChanged : function() {
return this._checkIfSegmentsChanged(true);
},
// ====================== fitColumns ======================
_fitColumnsReset : function() {
this.fitColumns = {
x : 0,
y : 0,
width : 0
};
},
_fitColumnsLayout : function( $elems ) {
var instance = this,
containerHeight = this.element.height(),
props = this.fitColumns;
$elems.each( function() {
var $this = $(this),
atomW = $this.outerWidth(true),
atomH = $this.outerHeight(true);
if ( props.y !== 0 && atomH + props.y > containerHeight ) {
// if this element cannot fit in the current column
props.x = props.width;
props.y = 0;
}
// position the atom
instance._pushPosition( $this, props.x, props.y );
props.width = Math.max( props.x + atomW, props.width );
props.y += atomH;
});
},
_fitColumnsGetContainerSize : function () {
return { width : this.fitColumns.width };
},
_fitColumnsResizeChanged : function() {
return true;
},
// ====================== cellsByColumn ======================
_cellsByColumnReset : function() {
this.cellsByColumn = {
index : 0
};
// get this.cellsByColumn.columnWidth
this._getSegments();
// get this.cellsByColumn.rowHeight
this._getSegments(true);
},
_cellsByColumnLayout : function( $elems ) {
var instance = this,
props = this.cellsByColumn;
$elems.each( function(){
var $this = $(this),
col = Math.floor( props.index / props.rows ),
row = props.index % props.rows,
x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
instance._pushPosition( $this, x, y );
props.index ++;
});
},
_cellsByColumnGetContainerSize : function() {
return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth };
},
_cellsByColumnResizeChanged : function() {
return this._checkIfSegmentsChanged(true);
},
// ====================== straightAcross ======================
_straightAcrossReset : function() {
this.straightAcross = {
x : 0
};
},
_straightAcrossLayout : function( $elems ) {
var instance = this;
$elems.each( function( i ){
var $this = $(this);
instance._pushPosition( $this, instance.straightAcross.x, 0 );
instance.straightAcross.x += $this.outerWidth(true);
});
},
_straightAcrossGetContainerSize : function() {
return { width : this.straightAcross.x };
},
_straightAcrossResizeChanged : function() {
return true;
}
};
// ======================= imagesLoaded Plugin ===============================
/*!
* jQuery imagesLoaded plugin v1.1.0
* http://github.com/desandro/imagesloaded
*
* MIT License. by Paul Irish et al.
*/
// $('#my-container').imagesLoaded(myFunction)
// or
// $('img').imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// callback function gets image collection as argument
// `this` is the container
$.fn.imagesLoaded = function( callback ) {
var $this = this,
$images = $this.find('img').add( $this.filter('img') ),
len = $images.length,
blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==',
loaded = [];
function triggerCallback() {
callback.call( $this, $images );
}
function imgLoaded( event ) {
var img = event.target;
if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){
loaded.push( img );
if ( --len <= 0 ){
setTimeout( triggerCallback );
$images.unbind( '.imagesLoaded', imgLoaded );
}
}
}
// if no images, trigger immediately
if ( !len ) {
triggerCallback();
}
$images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoaded ).each( function() {
// cached images don't fire load sometimes, so we reset src.
var src = this.src;
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
// data uri bypasses webkit log warning (thx doug jones)
this.src = blank;
this.src = src;
});
return $this;
};
// helper function for logging errors
// $.error breaks jQuery chaining
var logError = function( message ) {
if ( window.console ) {
window.console.error( message );
}
};
// ======================= Plugin bridge ===============================
// leverages data method to either create or return $.Isotope constructor
// A bit from jQuery UI
// https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
// A bit from jcarousel
// https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
$.fn.isotope = function( options, callback ) {
if ( typeof options === 'string' ) {
// call method
var args = Array.prototype.slice.call( arguments, 1 );
this.each(function(){
var instance = $.data( this, 'isotope' );
if ( !instance ) {
logError( "cannot call methods on isotope prior to initialization; " +
"attempted to call method '" + options + "'" );
return;
}
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
logError( "no such method '" + options + "' for isotope instance" );
return;
}
// apply method
instance[ options ].apply( instance, args );
});
} else {
this.each(function() {
var instance = $.data( this, 'isotope' );
if ( instance ) {
// apply options & init
instance.option( options );
instance._init( callback );
} else {
// initialize new instance
$.data( this, 'isotope', new $.Isotope( options, this, callback ) );
}
});
}
// return jQuery object
// so plugin methods do not have to
return this;
};
})( window, jQuery );
// source --> http://www.mbsjets.com/wp-content/themes/sports-club/mixitup/screen.js?ver=4.8.19
jQuery(window).load(function(){
/* Isotope Portfolio */
var $container = jQuery('.portfolio');
$container.isotope({
filter: '*',
animationOptions: {
duration: 500,
easing: 'linear',
queue: false
}
});
jQuery(window).resize(function() {
setTimeout(function() {jQuery('.portfolio').isotope('reLayout');},550);
});
jQuery('.portfolio').isotope('reLayout');
jQuery('ul.portfoliofilter a').click(function(){
var selector = jQuery(this).attr('data-filter');
$container.isotope({
filter: selector,
animationOptions: {
duration: 500,
easing: 'linear',
queue: false
}
});
return false;
});
var $optionSets = jQuery('ul.portfoliofilter'),
$optionLinks = $optionSets.find('a');
$optionLinks.click(function(){
var $this = jQuery(this);
// don't proceed if already selected
if ( $this.hasClass('selected') ) {
return false;
}
var $optionSet = $this.parents('ul.portfoliofilter');
$optionSet.find('.selected').removeClass('selected');
$this.addClass('selected');
});
jQuery('.isotope-item').hover(function() {
var item = jQuery(this);
var textholder = item.find('.foliotextholder')
item.find('.folio_underlay').css({paddingBottom:35 + textholder.height()+"px"});
});
});
// source --> http://www.mbsjets.com/wp-content/themes/sports-club/mixitup/jquery.prettyPhoto5152.js?ver=4.8.19
/* ------------------------------------------------------------------------
Class: prettyPhoto
Use: Lightbox clone for jQuery
Author: Stephane Caron (http://www.no-margin-for-errors.com)
Version: 3.1.4
------------------------------------------------------------------------- */
(function($){$.prettyPhoto={version:'3.1.4'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({hook:'data-rel',animation_speed:'fast',ajaxcallback:function(){},slideshow:5000,autoplay_slideshow:false,opacity:0.80,show_title:true,allow_resize:true,allow_expand:true,default_width:500,default_height:344,counter_separator_label:'/',theme:'pp_default',horizontal_padding:20,hideflash:false,wmode:'opaque',autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,overlay_gallery_max:30,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:' \
',gallery_markup:'',image_markup:'',flash_markup:'',quicktime_markup:'',iframe_markup:'',inline_markup:'{content}
',custom_markup:'',social_tools:''},pp_settings);var matchedObjects=this,percentBased=false,pp_dimensions,pp_open,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),pp_slideshow;doresize=true,scroll_pos=_get_scroll();$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){_center_overlay();_resize_overlay();});if(pp_settings.keyboard_shortcuts){$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){if(typeof $pp_pic_holder!='undefined'){if($pp_pic_holder.is(':visible')){switch(e.keyCode){case 37:$.prettyPhoto.changePage('previous');e.preventDefault();break;case 39:$.prettyPhoto.changePage('next');e.preventDefault();break;case 27:if(!settings.modal)
$.prettyPhoto.close();e.preventDefault();break;};};};});};$.prettyPhoto.initialize=function(){settings=pp_settings;if(settings.theme=='pp_default')settings.horizontal_padding=16;if(settings.ie6_fallback&&$.browser.msie&&parseInt($.browser.version)==6)settings.theme="light_square";theRel=$(this).attr(settings.hook);galleryRegExp=/\[(?:.*)\]/;isSet=(galleryRegExp.exec(theRel))?true:false;pp_images=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr(settings.hook).indexOf(theRel)!=-1)return $(n).attr('href');}):$.makeArray($(this).attr('href'));pp_titles=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr(settings.hook).indexOf(theRel)!=-1)return($(n).find('img').attr('alt'))?$(n).find('img').attr('alt'):"";}):$.makeArray($(this).find('img').attr('alt'));pp_descriptions=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr(settings.hook).indexOf(theRel)!=-1)return($(n).attr('title'))?$(n).attr('title'):"";}):$.makeArray($(this).attr('title'));if(pp_images.length>settings.overlay_gallery_max)settings.overlay_gallery=false;set_position=jQuery.inArray($(this).attr('href'),pp_images);rel_index=(isSet)?set_position:$("a["+settings.hook+"^='"+theRel+"']").index($(this));_build_overlay(this);if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){_center_overlay();});$.prettyPhoto.open();return false;}
$.prettyPhoto.open=function(event){if(typeof settings=="undefined"){settings=pp_settings;if($.browser.msie&&$.browser.version==6)settings.theme="light_square";pp_images=$.makeArray(arguments[0]);pp_titles=(arguments[1])?$.makeArray(arguments[1]):$.makeArray("");pp_descriptions=(arguments[2])?$.makeArray(arguments[2]):$.makeArray("");isSet=(pp_images.length>1)?true:false;set_position=(arguments[3])?arguments[3]:0;_build_overlay(event.target);}
if($.browser.msie&&$.browser.version==6)$('select').css('visibility','hidden');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden');_checkPosition($(pp_images).size());$('.pp_loaderIcon').show();if(settings.deeplinking)
setHashtag();if(settings.social_tools){facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));$pp_pic_holder.find('.pp_social').html(facebook_like_link);}
if($ppt.is(':hidden'))$ppt.css('opacity',0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find('.currentTextHolder').text((set_position+1)+settings.counter_separator_label+$(pp_images).size());if(typeof pp_descriptions[set_position]!='undefined'&&pp_descriptions[set_position]!=""){$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));}else{$pp_pic_holder.find('.pp_description').hide();}
movie_width=(parseFloat(getParam('width',pp_images[set_position])))?getParam('width',pp_images[set_position]):settings.default_width.toString();movie_height=(parseFloat(getParam('height',pp_images[set_position])))?getParam('height',pp_images[set_position]):settings.default_height.toString();percentBased=false;if(movie_height.indexOf('%')!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-150);percentBased=true;}
if(movie_width.indexOf('%')!=-1){movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-150);percentBased=true;}
$pp_pic_holder.fadeIn(function(){(settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined")?$ppt.html(unescape(pp_titles[set_position])):$ppt.html(' ');imgPreloader="";skipInjection=false;switch(_getFileType(pp_images[set_position])){case'image':imgPreloader=new Image();nextImage=new Image();if(isSet&&set_position<$(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image();if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find('#pp_full_res')[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){pp_dimensions=_fitToViewport(imgPreloader.width,imgPreloader.height);_showContent();};imgPreloader.onerror=function(){alert('Image cannot be loaded. Make sure the path is correct and image exist.');$.prettyPhoto.close();};imgPreloader.src=pp_images[set_position];break;case'youtube':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=getParam('v',pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split('youtu.be/');movie_id=movie_id[1];if(movie_id.indexOf('?')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('?'));if(movie_id.indexOf('&')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('&'));}
movie='http://www.youtube.com/embed/'+movie_id;(getParam('data-rel',pp_images[set_position]))?movie+="?data-rel="+getParam('data-rel',pp_images[set_position]):movie+="?data-rel=1";if(settings.autoplay)movie+="&autoplay=1";toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case'vimeo':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=pp_images[set_position];var regExp=/http:\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regExp);movie='http://player.vimeo.com/video/'+match[2]+'?title=0&byline=0&portrait=0';if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=pp_dimensions['width']+'/embed/?moog_width='+pp_dimensions['width'];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);break;case'quicktime':pp_dimensions=_fitToViewport(movie_width,movie_height);pp_dimensions['height']+=15;pp_dimensions['contentHeight']+=15;pp_dimensions['containerHeight']+=15;toInject=settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case'flash':pp_dimensions=_fitToViewport(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf('flashvars')+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf('?'));toInject=settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);break;case'iframe':pp_dimensions=_fitToViewport(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf('iframe')-1);toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);break;case'ajax':doresize=false;pp_dimensions=_fitToViewport(movie_width,movie_height);doresize=true;skipInjection=true;$.get(pp_images[set_position],function(responseHTML){toInject=settings.inline_markup.replace(/{content}/g,responseHTML);$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();});break;case'custom':pp_dimensions=_fitToViewport(movie_width,movie_height);toInject=settings.custom_markup;break;case'inline':myClone=$(pp_images[set_position]).clone().append('
').css({'width':settings.default_width}).wrapInner('').appendTo($('body')).show();doresize=false;pp_dimensions=_fitToViewport($(myClone).width(),$(myClone).height());doresize=true;$(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());break;};if(!imgPreloader&&!skipInjection){$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();};});return false;};$.prettyPhoto.changePage=function(direction){currentGalleryPage=0;if(direction=='previous'){set_position--;if(set_position<0)set_position=$(pp_images).size()-1;}else if(direction=='next'){set_position++;if(set_position>$(pp_images).size()-1)set_position=0;}else{set_position=direction;};rel_index=set_position;if(!doresize)doresize=true;if(settings.allow_expand){$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');}
_hideContent(function(){$.prettyPhoto.open();});};$.prettyPhoto.changeGalleryPage=function(direction){if(direction=='next'){currentGalleryPage++;if(currentGalleryPage>totalPage)currentGalleryPage=0;}else if(direction=='previous'){currentGalleryPage--;if(currentGalleryPage<0)currentGalleryPage=totalPage;}else{currentGalleryPage=direction;};slide_speed=(direction=='next'||direction=='previous')?settings.animation_speed:0;slide_to=currentGalleryPage*(itemsPerPage*itemWidth);$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);};$.prettyPhoto.startSlideshow=function(){if(typeof pp_slideshow=='undefined'){$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){$.prettyPhoto.stopSlideshow();return false;});pp_slideshow=setInterval($.prettyPhoto.startSlideshow,settings.slideshow);}else{$.prettyPhoto.changePage('next');};}
$.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});clearInterval(pp_slideshow);pp_slideshow=undefined;}
$.prettyPhoto.close=function(){if($pp_overlay.is(":animated"))return;$.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){$(this).remove();});$pp_overlay.fadeOut(settings.animation_speed,function(){if($.browser.msie&&$.browser.version==6)$('select').css('visibility','visible');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible');$(this).remove();$(window).unbind('scroll.prettyphoto');clearHashtag();settings.callback();doresize=true;pp_open=false;delete settings;});};function _showContent(){$('.pp_loaderIcon').hide();projectedTop=scroll_pos['scrollTop']+((windowHeight/2)-(pp_dimensions['containerHeight']/2));if(projectedTop<0)projectedTop=0;$ppt.fadeTo(settings.animation_speed,1);$pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentHeight'],width:pp_dimensions['contentWidth']},settings.animation_speed);$pp_pic_holder.animate({'top':projectedTop,'left':((windowWidth/2)-(pp_dimensions['containerWidth']/2)<0)?0:(windowWidth/2)-(pp_dimensions['containerWidth']/2),width:pp_dimensions['containerWidth']},settings.animation_speed,function(){$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);if(isSet&&_getFileType(pp_images[set_position])=="image"){$pp_pic_holder.find('.pp_hoverContainer').show();}else{$pp_pic_holder.find('.pp_hoverContainer').hide();}
if(settings.allow_expand){if(pp_dimensions['resized']){$('a.pp_expand,a.pp_contract').show();}else{$('a.pp_expand').hide();}}
if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open)$.prettyPhoto.startSlideshow();settings.changepicturecallback();pp_open=true;});_insert_gallery();pp_settings.ajaxcallback();};function _hideContent(callback){$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){$('.pp_loaderIcon').show();callback();});};function _checkPosition(setCount){(setCount>1)?$('.pp_nav').show():$('.pp_nav').hide();};function _fitToViewport(width,height){resized=false;_getDimensions(width,height);imageWidth=width,imageHeight=height;if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allow_resize&&!percentBased){resized=true,fitting=false;while(!fitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{fitting=true;};pp_containerHeight=imageHeight,pp_containerWidth=imageWidth;};_getDimensions(imageWidth,imageHeight);if((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight)){_fitToViewport(pp_containerWidth,pp_containerHeight)};};return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(pp_containerHeight),containerWidth:Math.floor(pp_containerWidth)+(settings.horizontal_padding*2),contentHeight:Math.floor(pp_contentHeight),contentWidth:Math.floor(pp_contentWidth),resized:resized};};function _getDimensions(width,height){width=parseFloat(width);height=parseFloat(height);$pp_details=$pp_pic_holder.find('.pp_details');$pp_details.width(width);detailsHeight=parseFloat($pp_details.css('marginTop'))+parseFloat($pp_details.css('marginBottom'));$pp_details=$pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({'position':'absolute','top':-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if($.browser.msie&&$.browser.version==7)detailsHeight+=8;$pp_details.remove();$pp_title=$pp_pic_holder.find('.ppt');$pp_title.width(width);titleHeight=parseFloat($pp_title.css('marginTop'))+parseFloat($pp_title.css('marginBottom'));$pp_title=$pp_title.clone().appendTo($('body')).css({'position':'absolute','top':-10000});titleHeight+=$pp_title.height();$pp_title.remove();pp_contentHeight=height+detailsHeight;pp_contentWidth=width;pp_containerHeight=pp_contentHeight+titleHeight+$pp_pic_holder.find('.pp_top').height()+$pp_pic_holder.find('.pp_bottom').height();pp_containerWidth=width;}
function _getFileType(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)||itemSrc.match(/youtu\.be/i)){return'youtube';}else if(itemSrc.match(/vimeo\.com/i)){return'vimeo';}else if(itemSrc.match(/\b.mov\b/i)){return'quicktime';}else if(itemSrc.match(/\b.swf\b/i)){return'flash';}else if(itemSrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemSrc.match(/\bajax=true\b/i)){return'ajax';}else if(itemSrc.match(/\bcustom=true\b/i)){return'custom';}else if(itemSrc.substr(0,1)=='#'){return'inline';}else{return'image';};};function _center_overlay(){if(doresize&&typeof $pp_pic_holder!='undefined'){scroll_pos=_get_scroll();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=(windowHeight/2)+scroll_pos['scrollTop']-(contentHeight/2);if(projectedTop<0)projectedTop=0;if(contentHeight>windowHeight)
return;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+scroll_pos['scrollLeft']-(contentwidth/2)});};};function _get_scroll(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};}else if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};}else if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};};};function _resize_overlay(){windowHeight=$(window).height(),windowWidth=$(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height($(document).height()).width(windowWidth);};function _insert_gallery(){if(isSet&&settings.overlay_gallery&&_getFileType(pp_images[set_position])=="image"&&(settings.ie6_fallback&&!($.browser.msie&&parseInt($.browser.version)==6))){itemWidth=52+5;navWidth=(settings.theme=="facebook"||settings.theme=="pp_default")?50:30;itemsPerPage=Math.floor((pp_dimensions['containerWidth']-100-navWidth)/itemWidth);itemsPerPage=(itemsPerPage";};toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find('#pp_full_res').after(toInject);$pp_gallery=$('.pp_pic_holder .pp_gallery'),$pp_gallery_li=$pp_gallery.find('li');$pp_gallery.find('.pp_arrow_next').click(function(){$.prettyPhoto.changeGalleryPage('next');$.prettyPhoto.stopSlideshow();return false;});$pp_gallery.find('.pp_arrow_previous').click(function(){$.prettyPhoto.changeGalleryPage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_content').hover(function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();},function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();});itemWidth=52+5;$pp_gallery_li.each(function(i){$(this).find('a').click(function(){$.prettyPhoto.changePage(i);$.prettyPhoto.stopSlideshow();return false;});});};if(settings.slideshow){$pp_pic_holder.find('.pp_nav').prepend('Play')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});}
$pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);$pp_overlay.css({'opacity':0,'height':$(document).height(),'width':$(window).width()}).bind('click',function(){if(!settings.modal)$.prettyPhoto.close();});$('a.pp_close').bind('click',function(){$.prettyPhoto.close();return false;});if(settings.allow_expand){$('a.pp_expand').bind('click',function(e){if($(this).hasClass('pp_expand')){$(this).removeClass('pp_expand').addClass('pp_contract');doresize=false;}else{$(this).removeClass('pp_contract').addClass('pp_expand');doresize=true;};_hideContent(function(){$.prettyPhoto.open();});return false;});}
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');$.prettyPhoto.stopSlideshow();return false;});_center_overlay();};if(!pp_alreadyInitialized&&getHashtag()){pp_alreadyInitialized=true;hashIndex=getHashtag();hashRel=hashIndex;hashIndex=hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);hashRel=hashRel.substring(0,hashRel.indexOf('/'));setTimeout(function(){$("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click');},50);}
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize);};function getHashtag(){url=location.href;hashtag=(url.indexOf('#prettyPhoto')!==-1)?decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)):false;return hashtag;};function setHashtag(){if(typeof theRel=='undefined')return;location.hash=theRel+'/'+rel_index+'/';};function clearHashtag(){if(location.href.indexOf('#prettyPhoto')!==-1)location.hash="prettyPhoto";}
function getParam(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^]*)";var regex=new RegExp(regexS);var results=regex.exec(url);return(results==null)?"":results[1];}})(jQuery);var pp_alreadyInitialized=false;
jQuery(document).ready(function() {
jQuery("a[data-rel^='prettyPhoto']").prettyPhoto({
autoplay: false,
deeplinking: false,
animation_speed: 'fast', /* fast/slow/normal */
slideshow: 5000, /* false OR interval time in ms */
autoplay_slideshow: false, /* true/false */
opacity: 0.8, /* Value between 0 and 1 */
show_title: true, /* true/false */
allow_resize: true, /* Resize the photos bigger than viewport. true/false */
default_width: 500,
default_height: 344,
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
horizontal_padding: 20, /* The padding on each side of the picture */
overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
social_tools: false
});
});
// source --> http://www.mbsjets.com/wp-content/themes/sports-club/js/jquery.flexisel.js?ver=4.8.19
/*
* File: jquery.flexisel.js
* Version: 1.0.2
* Description: Responsive carousel jQuery plugin
* Author: 9bit Studios
* Copyright 2012, 9bit Studios
* http://www.9bitstudios.com
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function ($) {
$.fn.flexisel = function(options) {
var defaults = $.extend({
visibleItems : 4,
animationSpeed : 200,
autoPlay : false,
autoPlaySpeed : 3000,
pauseOnHover : true,
setMaxWidthAndHeight : false,
enableResponsiveBreakpoints : true,
flipPage: false,
clone : true,
responsiveBreakpoints : {
portrait: {
changePoint:480,
visibleItems: 1
},
landscape: {
changePoint:640,
visibleItems: 2
},
tablet: {
changePoint:768,
visibleItems: 3
}
}
}, options);
/******************************
Private Variables
*******************************/
var object = $(this);
var settings = $.extend(defaults, options);
var itemsWidth; // Declare the global width of each item in carousel
var canNavigate = true;
var itemsVisible = settings.visibleItems; // Get visible items
var totalItems = object.children().length; // Get number of elements
var responsivePoints = [];
/******************************
Public Methods
*******************************/
var methods = {
init : function() {
return this.each(function() {
methods.appendHTML();
methods.setEventHandlers();
methods.initializeItems();
});
},
/******************************
Initialize Items
Fully initialize everything. Plugin is loaded and ready after finishing execution
*******************************/
initializeItems : function() {
var listParent = object.parent();
var innerHeight = listParent.height();
var childSet = object.children();
methods.sortResponsiveObject(settings.responsiveBreakpoints);
var innerWidth = listParent.width(); // Set widths
itemsWidth = (innerWidth) / itemsVisible;
childSet.width(itemsWidth);
if (settings.clone) {
childSet.last().insertBefore(childSet.first());
childSet.last().insertBefore(childSet.first());
object.css({
'left' : -itemsWidth
});
}
object.fadeIn();
$(window).trigger("resize"); // needed to position arrows correctly
},
/******************************
Append HTML
Add additional markup needed by plugin to the DOM
*******************************/
appendHTML : function() {
object.addClass("nbs-flexisel-ul");
object.wrap("");
object.find("li").addClass("nbs-flexisel-item");
var flexiselInner = object.parent(); // flexisel-inner
if (settings.setMaxWidthAndHeight) {
var baseWidth = $(".nbs-flexisel-item img").width();
var baseHeight = $(".nbs-flexisel-item img").height();
$(".nbs-flexisel-item img").css("max-width", baseWidth);
$(".nbs-flexisel-item img").css("max-height", baseHeight);
}
$("").insertAfter(flexiselInner);
if (settings.clone) {
var cloneContent = object.children().clone();
object.append(cloneContent);
}
},
/******************************
Set Event Handlers
Set events: click, resize, etc
*******************************/
setEventHandlers : function() {
var listParent = object.parent();
var flexiselInner = listParent.parent();
var childSet = object.children();
var leftArrow = flexiselInner.find(".nbs-flexisel-nav-left");
var rightArrow = flexiselInner.find(".nbs-flexisel-nav-right");
$(window).on("resize", function(event) {
methods.setResponsiveEvents();
var innerWidth = $(listParent).width();
var innerHeight = $(listParent).height();
itemsWidth = (innerWidth) / itemsVisible;
childSet.width(itemsWidth);
if (settings.clone) {
object.css({
'left' : -itemsWidth
});
}else {
object.css({
'left' : 0
});
}
// Hide the arrows if the elements are the same of the visible
if (!settings.clone && totalItems <= itemsVisible) {
leftArrow.add(rightArrow).css('visibility', 'hidden');
}
else {
leftArrow.add(rightArrow).css('visibility', 'visible');
var halfArrowHeight = (leftArrow.height()) / 2;
var arrowMargin = (innerHeight / 2) - halfArrowHeight;
leftArrow.css("top", arrowMargin + "px");
rightArrow.css("top", arrowMargin + "px");
}
});
$(leftArrow).on("click", function(event) {
methods.scrollLeft();
});
$(rightArrow).on("click", function(event) {
methods.scrollRight();
});
if (settings.pauseOnHover === true) {
$(".nbs-flexisel-item").on({
mouseenter : function() {
canNavigate = false;
},
mouseleave : function() {
canNavigate = true;
}
});
}
if (settings.autoPlay === true) {
setInterval(function() {
if (canNavigate === true)
methods.scrollRight();
}, settings.autoPlaySpeed);
}
object[0].addEventListener('touchstart', methods.touchHandler.handleTouchStart, false);
object[0].addEventListener('touchmove', methods.touchHandler.handleTouchMove, false);
},
/******************************
Set Responsive Events
Set breakpoints depending on responsiveBreakpoints
*******************************/
setResponsiveEvents: function() {
var contentWidth = $('html').width();
if(settings.enableResponsiveBreakpoints) {
var largestCustom = responsivePoints[responsivePoints.length-1].changePoint; // sorted array
for(var i in responsivePoints) {
if(contentWidth >= largestCustom) { // set to default if width greater than largest custom responsiveBreakpoint
itemsVisible = settings.visibleItems;
break;
}
else { // determine custom responsiveBreakpoint to use
if(contentWidth < responsivePoints[i].changePoint) {
itemsVisible = responsivePoints[i].visibleItems;
break;
}
else
continue;
}
}
}
},
/******************************
Sort Responsive Object
Gets all the settings in resposiveBreakpoints and sorts them into an array
*******************************/
sortResponsiveObject: function(obj) {
var responsiveObjects = [];
for(var i in obj) {
responsiveObjects.push(obj[i]);
}
responsiveObjects.sort(function(a, b) {
return a.changePoint - b.changePoint;
});
responsivePoints = responsiveObjects;
},
/******************************
Scroll Left
*******************************/
scrollLeft : function() {
if (object.position().left < 0) {
if (canNavigate === true) {
canNavigate = false;
var listParent = object.parent();
var innerWidth = listParent.width();
itemsWidth = (innerWidth) / itemsVisible;
var childSet = object.children();
var increment = (settings.flipPage)? innerWidth: itemsWidth;
object.animate({
'left' : "+=" + increment
}, {
queue : false,
duration : settings.animationSpeed,
easing : "linear",
complete : function() {
if (settings.clone) {
childSet.last().insertBefore(childSet.first()); // Get the first list item and put it after the last list item (that's how the infinite effects is made)
}
methods.adjustScroll();
canNavigate = true;
}
});
}
}
},
/******************************
Scroll Right
*******************************/
scrollRight : function() {
var listParent = object.parent();
var innerWidth = listParent.width();
itemsWidth = (innerWidth) / itemsVisible;
var difObject = (itemsWidth - innerWidth);
var objPosition = (object.position().left + ((totalItems-itemsVisible)*itemsWidth)-innerWidth);
var increment = (settings.flipPage)? innerWidth: itemsWidth;
if((difObject <= Math.ceil(objPosition)) && (!settings.clone)){
if (canNavigate === true) {
canNavigate = false;
object.animate({
'left' : "-=" + increment
}, {
queue : false,
duration : settings.animationSpeed,
easing : "linear",
complete : function() {
methods.adjustScroll();
canNavigate = true;
}
});
}
} else if(settings.clone){
if (canNavigate === true) {
canNavigate = false;
var childSet = object.children();
object.animate({
'left' : "-=" + increment
}, {
queue : false,
duration : settings.animationSpeed,
easing : "linear",
complete : function() {
childSet.first().insertAfter(childSet.last()); // Get the first list item and put it after the last list item (that's how the infinite effects is made)
methods.adjustScroll();
canNavigate = true;
}
});
}
};
},
/******************************
Adjust Scroll
*******************************/
adjustScroll : function() {
var listParent = object.parent();
var childSet = object.children();
var innerWidth = listParent.width();
itemsWidth = (innerWidth) / itemsVisible;
childSet.width(itemsWidth);
var increment = (settings.flipPage)? innerWidth: itemsWidth;
if (settings.clone) {
object.css({
'left' : -increment
});
}
},
touchHandler: {
xDown: null,
yDown: null,
handleTouchStart: function(evt) {
this.xDown = evt.touches[0].clientX;
this.yDown = evt.touches[0].clientY;
},
handleTouchMove: function (evt) {
if (!this.xDown || !this.yDown) {
return;
}
var xUp = evt.touches[0].clientX;
var yUp = evt.touches[0].clientY;
var xDiff = this.xDown - xUp;
var yDiff = this.yDown - yUp;
// only comparing xDiff
// compare which is greater against yDiff to determine whether left/right or up/down e.g. if (Math.abs( xDiff ) > Math.abs( yDiff ))
if (Math.abs( xDiff ) > 0) {
if ( xDiff > 0 ) {
// swipe left
methods.scrollRight();
} else {
//swipe right
methods.scrollLeft();
}
}
/* reset values */
this.xDown = null;
this.yDown = null;
canNavigate = true;
}
}
};
if (methods[options]) { // $("#element").pluginName('methodName', 'arg1', 'arg2');
return methods[options].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof options === 'object' || !options) { // $("#element").pluginName({ option: 1, option:2 });
return methods.init.apply(this);
} else {
$.error('Method "' + method + '" does not exist in flexisel plugin!');
}
};
})(jQuery);
// source --> http://www.mbsjets.com/wp-content/themes/sports-club/popupvideo/grt-youtube-popup.js?ver=4.8.19
/*!
* GRT Youtube Popup - jQuery Plugin
* Version: 1.0
* Author: GRT107
*
* Copyright (c) 2017 GRT107
* Released under the MIT license
*/
(function ( $ ) {
$.fn.grtyoutube = function( options ) {
return this.each(function() {
// Get video ID
var getvideoid = $(this).attr("youtubeid");
// Default options
var settings = $.extend({
videoID: getvideoid,
autoPlay: true,
theme: "dark"
}, options );
// Convert some values
if(settings.autoPlay === true) { settings.autoPlay = 1 } else if(settings.autoPlay === false) { settings.autoPlay = 0 }
if(settings.theme === "dark") { settings.theme = "grtyoutube-dark-theme" } else if(settings.theme === "light") { settings.theme = "grtyoutube-light-theme" }
// Initialize on click
if(getvideoid) {
$(this).on( "click", function() {
$("body").append('');
});
}
// Close the box on click or escape
$(this).on('click', function (event) {
event.preventDefault();
$(".grtyoutube-popup-close, .grtyoutube-popup").click(function(){
$(".grtyoutube-popup").remove();
});
});
$(document).keyup(function(event) {
if (event.keyCode == 27){
$(".grtyoutube-popup").remove();
}
});
});
};
}( jQuery ));
// source --> http://www.mbsjets.com/wp-content/themes/sports-club/js/custom-animation.js?ver=4.8.19
jQuery(window).scroll(function() {
jQuery('#pagearea .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInUp");
}
});
jQuery('.welcomebx .welcome_titlecolumn').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInLeft");
}
});
jQuery('.welcomebx .welcome_contentcolumn').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInRight");
}
});
jQuery('#pagearea-services .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInUp");
}
});
jQuery('#section1 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInUp");
}
});
jQuery('#section2 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInUp");
}
});
jQuery('#section3 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInLeft");
}
});
jQuery('#section4 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("bounceIn");
}
});
jQuery('#section5 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInRight");
}
});
jQuery('#section6 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("flipInX");
}
});
jQuery('#section7 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("zoomIn");
}
});
jQuery('#section8 .container ').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInLeft");
}
});
jQuery('#section9 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInRight");
}
});
jQuery('#section10 .container').each(function(){
var imagePos = jQuery(this).offset().top;
var topOfWindow = jQuery(window).scrollTop();
if (imagePos < topOfWindow+400) {
jQuery(this).addClass("fadeInUp");
}
});
});